Allah the Exalted revealed: And We caused a fount of (molten) brass to flow for him, and there were jinns that worked in front of him by the Leave of his Lord, and whosoever of them turned aside from Our Command, We shall cause him to taste of the torment of the blazing Fire. They worked for him what he desired, (making) high rooms, images, basins as large as reservoirs, and (making) cauldrons fixed (in their places). 'Work you, 0 family of David, with thanks!" But few of My slaves are grateful.
Then when we decreed death for him (Solomon), nothing informed them (jinns) of his death except a little worm of the earth, which kept (slowly) gnawing a way at his stick, so when he fell down, the jinns saw clearly that if they had known the unseen, they would not have stayed in the humiliating torment. Surah 34: 12-14