- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 11:29 AM
I've seen this topic multiple times around the community but the solutions on do not seem to work for my code. It updates the field for a brief second then when it loads on the list, it reverts back to the original value.
Table: <Extended_task_table>
Order: 100
Action name: statusupdate
Active: Checked
Show update: Checked
Onclick: statusChange()
Condition: current.state == 10
function statusChange(){
g_form.setValue('state',20);
gsftSubmit(null, g_form.getFormElement(), 'statusupdate');
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
current.state = 20;
current.update();
action.setRedirectURL(current);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 11:56 AM
Ah, it was a scoping issue. Had to move the if statement and the serverSide function outside the original function.
Correct:
function statusChange(){
g_form.setValue('state',20);
gsftSubmit(null, g_form.getFormElement(), 'statusupdate');
}
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
current.state = 20;
current.update();
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2018 01:09 PM
I've tried to follow this but my script is still not working. The fields are updated and I'm returned to my RITM list. But the form isn't saved with the updated fields. Anyone see a difference?
Table: sc_req_item
Action name: do_expedite
Onclick: doExpedite()
Script:
function doExpedite() {
g_form.setValue('u_sr_urgency' , 'Expedited');
g_form.setValue('work_notes' , 'RITM Expedited by ' + g_scratchpad.name);
gsftSubmit(null, g_form.getFormElement(), 'do_expedite');
}
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
current.u_sr_urgency = 'Expedited';
current.work_notes = 'RITM Expedited by ' + g_scratchpad.name;
current.update();
action.setRedirectURL(current);
}