We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

g_form.setValue not working in agent workspace

Rosy14
Kilo Sage

Hi, below setValue not working in workspace.

Rosy14_0-1710231757905.png

function onclick(g_form) {
    //g_form.setValue("u_report_flag", 1);
    var attSys = g_scratchpad.AttSysID;
    top.window.open("/sys_attachment.do?sys_id=" + attSys, '_blank');
    win.focus();
    location.reload(true);
}
4 REPLIES 4

Mark Manders
Giga Patron

Your value isn't saved to the form, before you do a reload. You can try using 'g_form.save()'


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

tried still not working

Shruti
Giga Sage

Hi,

You can make the UI action run on server side as well as client side

Instead of using g_form.setValue in client side , try to update report flag value in server side code current.u_report_flag = 1

this field is a custom field. when i am updating description field extended to task table it is updating but in case table custom field not working