Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI builder client script to hide attachments icon when state is closed

kiran kumar m1
Tera Contributor

I need a functionality in my workspace such that if I close the ticket ,the attachments icon should not be visible , I went to UI builder open the attachments tab wrote a script over there    

function evaluateProperty({api, helpers}) {
// Fetch the current state of the ticket
const currentState = api.state.record['state'];

// Check if the state is 3
if (currentState === 3) {
return false; // Hide the attachment icon
}

return true; // Show the attachment icon for all other states
}

 

but this seems not working for me , can anyone help in  syntax of this script

0 REPLIES 0