on 2016 Apr 12 10:41 AM
Hi gurus,
I have been task to design a 2 step approval workflow that searches for 2 approval agents on the collaborators tab from the master agreement but my approvers are not receiving anything in their inboxes.
Thanks in advance for your response.
Please advise if there is no other way to do this development.
Below is my code:
import com.sap.odp.api.common.exception.*;
import com.sap.odp.api.ibean.*;
import com.sap.odp.api.util.*;
import com.sap.odp.api.common.types.*;
import com.sap.odp.api.workflow.*;
import com.sap.odp.api.doc.collaboration.*;
import com.sap.odp.api.doccommon.userdefined.*;
import com.sap.odp.api.common.platform.*;
import com.sap.odp.api.common.log.Logger;
logMsg = Logger.createLogMessage(session);
logMsg.setLogMessage("[ContractApprovalWF -Lease_Approver1]");
Logger.info(logMsg);
home = doc.getIBeanHomeIfc();
ObjectReferenceIfc principal;
// find approver from collaborators
// CollabRoleHome = IBeanHomeLocator.lookup(session,CollaboratorRoleIBeanHomeIfc.sHOME_NAME);
// approverRole = CollabRoleHome.findUniqueByName("SANBS Legal Representative");
// approverRole = CollabRoleHome.findUniqueByName("SANBS Executive");
// parentDoc = doc.getParentIBean();
// collabCollection = parentDoc.getCollaborators();
// done = false;
// for(int i = 0; i < collabCollection.size() && done == false; i++ ){
// collaborator = collabCollection.get(i);
// if(collaborator.getCollaboratorRole().equals(approverRole.getObjectReference())){
// principal = collaborator.getPrincipal();
// done = true;
// }
// }
//get approver from extesion
principal = doc.getExtensionField("SANBS Lease Approver1").get();
// If an approver was established based on the logic then add them as an approver now.
if (hasValue(principal))
{
addApprover(principal);
}
else
{
cancelProcess("Invalid Lease Approver");
}
Regards,
Request clarification before answering.
Hi Sabelo,
Just noticed this:
doc.getExtensionField("SANBS Lease Approver1").get()
I don't think it's correct to have spaces there; make sure you get the correct technical name from extension definitions.
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sabelo ... generally, if the system allows you to 'save' the code, then there is nothing wrong with it.
If on the other hand the script does not work as you expect, then the problem is within the script logic.
Unfortunately, nobody can say what is really wrong without knowing your system and knowing your requirements.
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.