How to get check box value in run script

siddharth29
Mega Contributor

Hi team,

I am trying to design a work flow like the below screen shot.

Capture.PNG

and in run script i mentioned script like,

answer = ifScript();

function ifScript() {

  gs.log("@@@@hgst items"+current.variables.u_computer);

  if (current.variables.u_computer== "true") {

              return 'yes';

    }

    return 'no';

}

if   "computer check box is checked by user" then the request should go the "approval group as designed in workflow".... when i kept gs log also check box value is not getting in logs.

please guide me how to get check box value if it is checked request should go approval group

thank you.

1 ACCEPTED SOLUTION

Hi Prabhakar,



Please edit your previous post and remove the password.


I tried to reproduce on my instance and it didn't worked..Later on I realized that I am doing the same mistake...:P



You should not use "Run Script" for this and it should be the "If" activity with the script as below



answer = ifScript();


    function ifScript() {


    if (current.variables.u_computer == 'true') {


    return 'yes';


  }


    return 'no';


  }



P.S : I didn't login to your instance so please make the necessary modifications.



I hope this helps


View solution in original post

10 REPLIES 10

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

HI Prabhakar,



Try this.


answer = ifScript();


function ifScript() {


  if (current.variables.u_computer) {


              return 'yes';


    }


    return 'no';


}



Just remove gs.log line and also make sure that the u_computer is the exact name of the catalog variable.


hi pradeep,



actually if it is checked true only req should go to group...


Yes it will work. Did you try?


yeah tried but no not working pradeep