UI Action not updating field

John209
Giga Expert

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);

        }

}

1 ACCEPTED SOLUTION

John209
Giga Expert

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);


}


View solution in original post

10 REPLIES 10

Sharee
Kilo Explorer

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);
}