- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 01:38 AM
Hi,
My Use Case is:
I have a field (u_previous_state) which is stores a String type value. It stores the value of the previous state.
I want to have a button, a UI Action which will change the state of my change request back to the previous state.
Here are the screenshots for the same:
Here -2 is the state value of previous state ('Scheduled' in this case)
My Script is as follows:
Condition- Current state is 'Pending Customer'-> value '-50'
The template is similar to some UI Actions built in in my developer instance.
However, when i click the ui action button, nothing happens. Is there something wrong with this script?
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 02:17 AM
Replace current.u_previous_state with g_form.getValue('state'); for line 3
For line 11 replace alert() with g_form.addInfoMessage('setRedirect function')l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 02:07 AM
Hi Mudit,
For debugging use 'alert' in the first function call, apart from this could you please try this code below?
function moveToPrevious(){
//alert('previousValue: ' + current.u_previous_value);
gsftSubmit(null, g_form.getFormElement(), 'state_model_move_to_previous');
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect(){
current.setValue('state', current.u_previous_state);
current.update();
action.setRedirectURL(current);
}
If it was helpful, please give positive feedback.
Thanks,
☆ Community Rising Star 22, 23 & 24 ☆
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 02:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 02:17 AM
Replace current.u_previous_state with g_form.getValue('state'); for line 3
For line 11 replace alert() with g_form.addInfoMessage('setRedirect function')l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 02:35 AM
Hi,
g_form.getValue('u_previous_state') does give an alert! current.u_previous_state wasnt giving any.
I changed the script accordingly. On click of the button the page now reloads.
However, the state change is not saved.
Before reloading, the state does change to scheduled, but this change isnt saved when i open the request again. Its back to Pending Customer State
My Script after Change is:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 02:38 AM
Switching gsftSubmit to g_form.save() as mentioned by