Run workflow from Order Guide not working

daniellethomson
Tera Expert

I have a new hire order guide that needs to be approved at the REQ level. I have created and attached a workflow on the sc_request level with a workflow property condition to run this workflow if Order Guide is New Hire. Unfortunately this workflow isn't running at all. Even though the Order Guide is set to run it the New Hire workflow it is running the OoO Service Request workflow instead. I changed the execution order thinking it would kick off the Order Guide workflow and that didn't work. I then modify the Service Request workflow to only run if no other condition matched and that didn't do the trick. What step am I missing??

8 REPLIES 8

The order guide record doesnt get submitted when the cart is order. It's just a guide and not a real item. Make sense? Below is a solution I have used before.




1. Create system property to list out the catalog items or categories that will always require approval at the request level.


2. Update OOTB workflow or create your own workflow to run at the request level to have a "IF" activity. Code below



 


//Code for request workflow. If statement will check to see if an approval is needed at the request level for new hire.


// if 'yes' is return then a approval is needed, 'no' means no approvals.


checkApproval();



function checkApproval() {


      //get property


      var catData = gs.getProperty('<< your property here>>'); //Need to create. Wasnt sure what naming style you wanted


      var cat = '';


      var catArr = catData.split(',');


      var reqItem = new GlideRecord('sc_req_item');


      reqItem.addQuery('request', current.sys_id);


      reqItem.query();


      while (reqItem.next()) {


              for (var i = 0; i < catArr.length; i++) {


                      cat = catArr[i];


                      if (reqItem.cat_item.category.title == cat) {     // Change if its not category driving to item driving.


                              return 'yes';


                      }


              }


      }


      return 'no';


}


Thank you for the explanation.



I'm not sure what you mean by 1. Create system property to list out the catalog items or categories that will always require approval at the request level.



I have two catalog items(Order Guides) New Hire and Transfer that will always need approval at the REQ level. How do I create a system property?


Let's make sure we are on the same page.   WIthin in the two order guides   do you have catalog items? If so, are they all listed under the same category or not?



To created a system property follow below link.  


Your property type will be string and then you would list out the items or category comma separated.



Adding a Property - ServiceNow Wiki


Yes, they are under category 'Employment Access Requests.'