- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 10:23 AM
Hello Everyone,
I have created 2 buttons(UI actions) named "Under Review" "Investigate" in problem ticket to move phase(process flow), state & stage. Phase, state & stage are updating also as expected but button is visible after the condition is false too. "Under Review" should not reflect if Phase,stage & state are Under Review.Written script and screenshot is below:
Script:
function updateUnderReview(){
g_form.setValue('state', '103');
g_form.setValue('u_stage', '101');
gsftSubmit(null, g_form.getFormElement(), 'under_review'); //MUST call the 'Action name' set in this UI Action
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverUnderReview();
function serverUnderReview(){
current.state = 103;
current.u_stage = 101;
current.update();
}
Below screenshot for Field: State,Type: Integer, Dependent value: Value of "Stage" field
For Process flow, please refer below:
Any idea where I am doing wrong the code.
Kind Regards,
Anu
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:59 AM
Hi Anu,
First of all current.state == '0' should be changed to only using 0 since it is an integer and not string
secondly check script include whether it is returning true/false properly
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 03:43 PM
I'm pretty sure the condition field is evaluated server side, so just drop the `javascript: ` bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:39 AM
That's fine.After removing `javascript: ` from condition also buttons are visible. My issue has not been resolved yet.
Thanks,
Anu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:59 AM
Hi Anu,
First of all current.state == '0' should be changed to only using 0 since it is an integer and not string
secondly check script include whether it is returning true/false properly
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader