Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action is not working

tushar_ghadage
Tera Contributor

I have a requirement where :

when only on assess and RCA state reject button should be visible ( working)

and when if clicked on assess then first make the work notes mandatory (its working) it should move back to new state (not working) & if clicked on RCA first it should make the work notes mandatory and then it should move back to assess state. (not working).

 

here is the code: 

onclick: setnotes()

condition :(current.state == 102 || current.state == 103) &&( current.approval == 'not requested');

 

function setnotes() {

    var prbvalue = g_form.getValue('state');
    var workvalue = g_form.getValue('work_notes');
    if (prbvalue == '102') {
        if( workvalue ==''){
        g_form.setMandatory('work_notes', true);
        }
        gsftSubmit(null, g_form.getFormElement(), 'reject_problem');
        saveNew();
       
    } else if (prbvalue == '103') {
        if( workvalue ==''){
        g_form.setMandatory('work_notes', true);
        }
        gsftSubmit(null, g_form.getFormElement(), 'reject_problem');
        saveAssess();
    }
}

function saveNew()
{
    current.state = 101; // new state
    current.update();
    action.setRedirectURL(current);
}


function saveAssess()
{
    current.state = 102; // Assess state
    current.update();
    action.setRedirectURL(current);
 
 what's the issue here 
 
anything would help!!
 
thanks!!
 
5 REPLIES 5

Additional - In this solution you have to create only one UI Action which is server callable .