- 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:32 AM
Could you please try this and say which values is returned in alert?
function moveToPrevious(){
alert('previousValue: ' + g_form.getValue('u_previous_value'));
gsftSubmit(null, g_form.getFormElement(), 'state_model_move_to_previous');
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect(){
current.setValue('state', g_form.getValue('u_previous_state'));
current.update();
action.setRedirectURL(current);
}
☆ Community Rising Star 22, 23 & 24 ☆
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2022 02:39 AM
Hi,
Yes it returns '-2' in the alert.
Setting the value in moveToPrevious function and using g_form.save() works!