cancel
Showing results for 
Search instead for 
Did you mean: 

2 Step Approval Workflow

Former Member
0 Kudos

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,

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190023
Contributor
0 Kudos

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

Former Member
0 Kudos

Let me check that out and give you feedback. Is there nothing wrong with the code though?

former_member190023
Contributor
0 Kudos

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