Workflow IF condition is not working.

AnandKumar1
Tera Expert

Hi Team,

I am working on a workflow part to skip the approvals based on RITM string value. Below the process.

We will create a SOW request through the sc_task. Here, i have to skip the approval based on the given value from RITM variable.

i have variable solution center (Single line text) Here based on the value i should skip the approval. If users give only "Rollouts" then approvals should be skipped in the workflow. 

The workflow is in sow module table. So i am using below script gliding the sc_req_item table and trying to set YES / NO in IF condition. But this is not working.

 

answer = ifScript();

function ifScript() {


    var gr1 = new GlideRecord('sc_req_item');
    gr1.addQuery('sys_id', requesteditem);
    gr1.query();
    if (gr1.next()) {

        var solutioncenter = gr1.variables.u_solution_center;
        gs.log('solutioncenter' + solutioncenter, 'a360879');
        if (solutioncenter == "Rollouts") {
           return 'yes';
        } 
        else {
            
            return 'no';
        }
    }
}

 

1 ACCEPTED SOLUTION

Hi,

you didn't share this info

in your script you have not defined what does the variable requesteditem holds?

are you sure it holds RITM sysId

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

AnandKumar1
Tera Expert

Hi Ankur,

i have used direct sow table and it works 🙂

 

Thanks...