Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

IF condition in workflow for a service catalog variable Item

aheetal
Tera Contributor

I've created a service catalog -> catalog item variable named "cmanager" having auto populated value based on selected user . During request, if user has no cmanager value, one task should create and if user has cmanager value task will skip , it will go for approval workflow. I'm creating an workflow for this catalog item and selecting 'If' condition from workflow activities. I feel for this 'If' condition I need to write a advance script. Can any one help how to write?

I have written below script and it is giving activity result No in both the condition :


answer = ifScript();

function ifScript() {

if(('current.variables.cmanager' != '')) {

              return 'no';

        }

else{

          return 'yes';

}

  }

1 ACCEPTED SOLUTION

angela_benway
Kilo Expert

Try this below. You do not need the single quotes surrounding the variable.



answer = ifScript();


function ifScript() {


if(current.variables.cmanager != '') {


              return 'no';


        }


else{


          return 'yes';


}


  }


View solution in original post

3 REPLIES 3

angela_benway
Kilo Expert

Try this below. You do not need the single quotes surrounding the variable.



answer = ifScript();


function ifScript() {


if(current.variables.cmanager != '') {


              return 'no';


        }


else{


          return 'yes';


}


  }


Hi Angela,


It is working fine now


Thank you very much for your help .


lawrence_eng
Administrator
Administrator

Moderator note:



I moved this thread from Community Updates & Feedback to Support, marked it as a question, and flagged the reply above as "Correct".



thanks,


Lawrence