UI Action sets a different value than the one in the script

mfhaciahmetoglu
Mega Sage

Hello all,

 

I have encountered a very weird problem.

 

I created a simple UI Action called "Cancel". Here is the settings:

mfhaciahmetoglu_0-1738860819669.png

mfhaciahmetoglu_1-1738860828426.png

 

It works just as expected when I click on it. The conditions are also working just fine:

 

mfhaciahmetoglu_2-1738860866758.png

 

But when I say OK, then the script set it to Closed Complete, instead of the value I prescribed:

 

mfhaciahmetoglu_4-1738860956825.png

 

mfhaciahmetoglu_3-1738860938683.png

I have no idea why this is happening? 

 

Thank you.

 

Best,

Firat

 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@mfhaciahmetoglu 

are you sure you are setting the correct choice value for that State field?

Usually state field is extended from task so you might be wrongly giving choice value from task table rather than your own table

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar ,

 

Here are the values:

mfhaciahmetoglu_0-1738861702146.png

I have also other buttons and they work perfectly fine. Only for this Cancel I have this weird problem.

 

Is it clashing with another UI Action possibly? 

 

Best,

Firat

 

@mfhaciahmetoglu 

are you sure no before update business rule is changing the state from 104 to 3 ?

otherwise script looks good to me

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Good indication indeed! 

I found that one BR that I created caused this issue.

Very weird, because in this BR what I do is the following:

I set active to False if the state is cancelled.

So, there is probably another BR that sets the state to closed complete because I set the active to false that comes from TASK table.

 

The reason I set this BR is because I want my custom records to be shown on "My Requests -> Closed Request " on the ESC when the state is Closed or Cancelled. My assumption was that this is shown on "Closed Request" list via active -> true/false flag but maybe I am mistaken. 

 

Do you have any idea about this issue?

 

Thanks!

 

Best,

Firat