Quantcast
Channel: Ariba Exchange: Message List
Viewing all articles
Browse latest Browse all 3363

Simple Rule JavaScript

$
0
0

I'll begin this by saying I've never done an update like this before myself.  Looking for assistance on how to add a simple rule java script to an existing rule set for a custom eform.  Need to be able to add a watcher group in parallel to the approval flow when a particular department ID is specified within a vector field.  Not entirely sure how to capture the value from the vector field and loop through it to see if the value matches.  Below is what I've created so far in an attempt to build this, thanks in advance for any assistance and or direction.

 

Condition:

 

function AddProcurementGroup_Condition (eform)

{

     // Add Procurement group to the flow based on certain cost centers

     // Some kind of loop goes here to step through the values of the vector field and sends it below to the isCostCenterSelected function

      // Eform have been checked -- no particular Cost Centers are present, so return false

}

 

function isCostCenterSelected(cc)

{  

     var checkCCs= new Array("44801","44802","44803","44804","44805","44806","44807","44808","44809","44810","44811","44812","44813","44814","44815","44816","44817","44818","44819","44820","44821");   

 

     // loop through and check cost centers  

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

     {    

          Log.javascript.debug("Compare " + checkCCs[i] + " & " + cc);     

          if (checkCCs[i].equals(cc))

          {return true;}  

     }  

     // match not found, return false

      return false;

     }

AddProcurementGroup_Condition; 

 

Action:

 

function AddProcurementGroup_action (eform)

{  

     // Add Procurement Group to Flow    

     var ProcurementGroup = Group.getGroup("Procurement");    

     return ApprovalRequest.create(eform, ProcurementGroup,true,"ruleReasons","ProcurementGroup");                                                 

}

AddProcurementGroup_action;


Viewing all articles
Browse latest Browse all 3363

Trending Articles