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 Action to save and update change record

johnrob18
Giga Guru

What do I put in my UI action to save my change record and move the state to next lifcycle state?

I currently have this

find_real_file.png

4 REPLIES 4

Atul Kumar2
Giga Guru

Hi John,



Create/edit the ui action with below code.



current.u_change_state='whatever next value is';(check the next value of choice list from the state field and give the value of choice lable)


current.update();


Hi, this sort of works.  


But, not when a record is opened for the first time it has the a state of New but it is not 'saved'


So putting Condition current.u_change_ _state='New' does not seem to work.


I have tried adding a step to the insert record   to create is a state othe r than New but dont seem to get anywewhere



find_real_file.png


Hi John,



Can't we write a business rule after the insert and code will be below.



current.u_change_state='xyz';



It will only work when new records are inserted and next state will be set as per above code . it will not work when on update.



Regards,


Atul Kumar


Atul Kumar2
Giga Guru

Please use the before in the business rule on insert database operation.



Regards,


Atul Kumar