How to apply 'if' condition before approval activity in workflows?

Ashirav
Tera Expert

It's a very basic workflow:-

find_real_file.png

Above, I want to make sure that Employee Email and Employee ID both are not blank before moving forward with the Approval. If they are blank, I wish to print a message that they are blank. Else, moving ahead with the approval.

Join condition doesnt work since Join doesnt club the conditions together. It just clubs branches together.

Please suggest a manner that can be used.

1 ACCEPTED SOLUTION

Yes it will work,

i have one question , why you use two if condition to check Employee Email and Employee ID?

you can also give 2 condition in  single if block.

as i were explain before you need only one if and one wait for condition block.

 

and if your issue is resolved then please marked my answer as correct.

 

 

View solution in original post

9 REPLIES 9

mattystern
Kilo Sage

I would use a "Wait for condition" to wait for the closure of the two catalog tasks

Here is the script I use in my workflows for waiting on task completion. It looks at the state of the tasks and waits if they are not completed:

var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.query();
while(gr.next()) {
if (gr.state == '1' || gr.state == '2' || gr.state == '-5' ) {
answer = false;
{break;}
} else {
{continue;}
}
}
if (answer != false){
answer = true;
}

 

SO you would flow the two tasks into the wait. You should also be able to flow the other sides of the if statements into this wait for condition, as they will default to true in a case where both are not blank.

Will the glide query work in workflow run-script activity or where?

vinothkumar
Tera Guru

If I am there, I will create an Hidden variable, that will check the values of Emp ID and email before submission and alert an user using onSubmit client script.

 

You can also use the same variable in the if condition of the workflow like current.variables.variable_name != '', then do your own logic

Pranay Tiwari
Kilo Guru

Hi,

 

you need to give 2 condition in condition block of  'if' 1st Employee Email  is not empty ,AND ,2nd Employee ID is not empty

connect No to wait for condition (in condition block of  'wait for condition' 1st Employee Email  is empty ,AND ,2nd Employee ID is empty).

and Yes to  approval.

 

Mark correct or helpful if it helps you.

 

Warm Regards,

Pranay Tiwari

| www.DxSherpa.com | pranay.tiwari@dxsherpa.com |