Want to call a System Property in a workflow

Jyoti36
Mega Expert

Hi there,

I have created a system property : ab.provision.workflow, type : true/false

I want to put an 'if condition' in workflow to check if this system property's value is true and current requester is from some abc company then fire the next sc task.

Can anyone please share the conditions, how can i achieve this?

Thanks!

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Jyo,



Here you go. Untested code.


answer = ifScript();    


function ifScript() {


  var prop =   gs.getProperty('ab.provision.workflow');


var comp = current.u_requestor.company.getDisplayValue(); //I am assuming u_requestor is the field company name


//var comp = current.variables.VARIBALENAME.getDisplayValue(); //for catalog variables


if(prop == 'true' && comp == 'company name')


  {    


            return 'yes';    


          }    


          return 'no';    


  }    


View solution in original post

9 REPLIES 9

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Jyo,



Here you go. Untested code.


answer = ifScript();    


function ifScript() {


  var prop =   gs.getProperty('ab.provision.workflow');


var comp = current.u_requestor.company.getDisplayValue(); //I am assuming u_requestor is the field company name


//var comp = current.variables.VARIBALENAME.getDisplayValue(); //for catalog variables


if(prop == 'true' && comp == 'company name')


  {    


            return 'yes';    


          }    


          return 'no';    


  }    


Comment line 4 and use line 5 in case it is a workflow on requested item


Thanks Pradeep, that was really helpful also I am just wondering for the requested_for company:


Actually the company is not there on the item form, but for requested_for I can call it like this right,


var comp = current.requested_for.company.getDisplayValue();


or


var comp = current.variables.requested_for.company.getDisplayValue();



Please guide.



Thanks!


Thanks for the update. Use 2nd line of code i.e


var comp = current.variables.requested_for.company.getDisplayValue();