Single workflow for multiple Catalog Items

sanithakavungal
Giga Contributor

Hi All,

I have to create a Single Workflow for Multiple Catalog Items.Kindly help me on fetching the Catalog Item Name on the IF condition so that it will trigger the corresponding Task

Example : ABCD Workflow

A,B,C,D--Seperate Catalog Items

Single workflow   "ABCD Workflow" for all the A,B,C,D Catalog Items depends on the conditions.

If Catalog Items is A task should go the group W

If Catalog Items is B task should go the group X

If Catalog Items is C task should go the group Y

If Catalog Items is D task should go the group Z

I used the below script on IF condition,but it's not working.

answer = ifScript();

function ifScript() {

  if(current.cat_item.getDispalyValue() == 'A'){

  return 'yes';

  }

  else

  return 'no';

}

Kindly Suggest..!!

find_real_file.png

find_real_file.png

find_real_file.png

Regards,

Sanitha

1 ACCEPTED SOLUTION

Hi Sanitha,



I believe you are running the workflow at the RITM level.



So, here is how I would proceed.



Evaulate the combination and save it in the scratchpad variable as below.



runIt();



function runIt(){


var catItem = '';


if(current.cat_item.getDisplayValue() == 'A'){


catItem = 'A';


}


else if(current.cat_item.getDisplayValue() == 'B'){


catItem = 'B';


}


else if (current.cat_item.getDisplayValue() == 'C'){


catItem = 'C';


}


else{


catItem = 'D';


}



workflow.scratchpad.item = catItem;


}



Based on the value create a task either using activity or script.


View solution in original post

5 REPLIES 5

sudharsanv36
Kilo Guru

Hi Sanitha,



I believe you are trying to achieve (Check the combinations using 'if' activity), but this might not provide the exact result since the output will be either 'yes' or 'no'.



Similar to boolean 0 or 1.



You can use a runScript activity for the same and here you can specify the code actions based on the combination selected by the user. I would recommend you to use that.


Hi Sudharsan,



Thanks for the reply..



Could you please explain with the script.



Regards,


Sanitha


Hi Sanitha,



I believe you are running the workflow at the RITM level.



So, here is how I would proceed.



Evaulate the combination and save it in the scratchpad variable as below.



runIt();



function runIt(){


var catItem = '';


if(current.cat_item.getDisplayValue() == 'A'){


catItem = 'A';


}


else if(current.cat_item.getDisplayValue() == 'B'){


catItem = 'B';


}


else if (current.cat_item.getDisplayValue() == 'C'){


catItem = 'C';


}


else{


catItem = 'D';


}



workflow.scratchpad.item = catItem;


}



Based on the value create a task either using activity or script.


Hi Sudharsanan,



Thanks..It worked..:)



Regards,


Sanitha