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

Re: Simple Rule JavaScript

$
0
0

Hi Jeremy,

 

Probably you could try something as below:

 

function AddProcurementGroup_Condition (eform)

{

          var list = eform.getFieldValue("TestVectorField");

          if (list != null)

          {

                    for(i=0; i < list.size(); i++)

                    {

                              var testObject = list.get(i);

                              var cc = testObject.getFieldValue("CostCenter");

                              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 (cc !=null && checkCCs[i].equals(cc))

                                        {return true;} 

                              } 

                              // match not found, return false

                              return false;

                    }

          }

}

 

 

In action, you will need to set third parameter in return statement to false. true defines that the approver will be added as an actual approver i.e. his approval will be required, whereas false means, it will be added as a watcher.

 

function AddProcurementGroup_action (eform)

     // Add Procurement Group to Flow   

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

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

}

AddProcurementGroup_action;

 

Best Regards,

Amit


Viewing all articles
Browse latest Browse all 3363

Trending Articles