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.

How can we change state as canceled?

Community Alums
Not applicable

Hello,

I would like to know about how can i change the state on incident form as canceled when user click on cancel ui action.

I created ui action - Cancel and action name - u_cancel 

And for state I wrote script -

current.setValue('u_cancel' , 'canceled');

current.update();

But it is not working. 

Thank you

 

 

 

1 ACCEPTED SOLUTION

Hi. Mark as Correct if it helped you resolve the issue. Thanks


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

View solution in original post

9 REPLIES 9

Hi. Mark as Correct if it helped you resolve the issue. Thanks


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Voona Rohila
Mega Patron
Mega Patron

Hi preeti

remove action name for your UI Action as it is not client side.

code:

current.setValue('state', 8);

current.update();​

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Community Alums
Not applicable
Thank you Can you tell me one more thing? I want to show this cancel ui action only those users who created the incident. What should be the condition for this ?

gs.getUserID()==current.opened_by


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Community Alums
Not applicable
Hey, i didn't get my requirement. I don't want cancel ui action on incident form, I want this button when user create an incident and submit the incident form then he open that incident then cancel ui action should be there such as update,resolve and delete. This should only for those user who created the incident. Can you tell me? How can I achieve this requirement?