4 Replies Latest reply on Mar 23, 2013 10:48 AM by Kevin Pinsky

    Request Dataset Values in Approval Workflows

      We want to access the data entered by the user in Request datasets in the Approval Workflows. As of now we are only able to access the default fields Effective date and Justification. How can we access the rest?
        • 1. Re: Request Dataset Values in Approval Workflows
          Vamsi Krishna
          In the approvalprocess.bpel Inside the java embedding activity - Create a variable "fname"

          for (oracle.iam.request.vo.RequestBeneficiaryEntityAttribute attr:attributes)
          String attrName =attr.getName();
          String attrValue=(String)attr.getValue();

          Then, add this in the payload and retrieve it wherever needed.

          • 2. Re: Request Dataset Values in Approval Workflows
            The parent dataset values are already present in the payload and name, value pairs under the ObjectDetails tag. You can easily use the copy operation to read these values into variables or anywhere you want to or use the code as mentioned previously.

            • 3. Re: Request Dataset Values in Approval Workflows
              Vamsi Krishna
              Right bikash, they will be available in the object details and when i tried to copy them in an email notification task, they were coming as null values. Then, using this code has retrieved me the values exactly as expected.

              • 4. Re: Request Dataset Values in Approval Workflows
                Kevin Pinsky
                It's all in the payload. Here is some sample information:

                //Retrieve Request ID
                Object reqIdXMLElem = getVariableData("inputVariable","payload","/ns3:process/ns4:RequestID");
                String reqId = ((oracle.xml.parser.v2.XMLElement)reqIdXMLElem).getText();
                //System.out.println("Request ID[" + reqId + "]");

                //Retrieve Requester Login
                Object requesterXMLElem = getVariableData("inputVariable", "payload","/ns3:process/ns4:RequesterDetails/ns4:Login");
                String requesterLogin = ((oracle.xml.parser.v2.XMLElement)requesterXMLElem).getText();

                //Retrieve Beneficiary Login
                Object beneficiaryLoginXMLElem = getVariableData("inputVariable", "payload","/ns3:process/ns4:BeneficiaryDetails/ns4:Login");
                String beneficiaryLogin = ((oracle.xml.parser.v2.XMLElement)beneficiaryLoginXMLElem).getText();

                //Retrieve Beneficiary Type
                Object beneficiaryTypeXMLElem = getVariableData("inputVariable", "payload","/ns3:process/ns4:BeneficiaryDetails/ns4:UserType");
                String beneficiaryType = ((oracle.xml.parser.v2.XMLElement)beneficiaryTypeXMLElem).getText();

                //Get Beneficiary Manager Login
                Object beneficiaryManagerLoginXMLElem = getVariableData("inputVariable", "payload","/ns3:process/ns4:BeneficiaryDetails/ns4:ManagerLogin");
                String beneficiaryManagerLogin = ((oracle.xml.parser.v2.XMLElement)beneficiaryManagerLoginXMLElem).getText();
                if (!beneficiaryManagerLogin.isEmpty()) approver = beneficiaryManagerLogin;

                //Get Object Deails
                Object resourceObjectXMLElem = getVariableData("inputVariable", "payload","/ns3:process/ns4:ObjectDetails/ns4:name");
                String resourceObject = ((oracle.xml.parser.v2.XMLElement)resourceObjectXMLElem).getText();

                //Get Action
                Object requestActionXMLElem = getVariableData("inputVariable","payload","/ns3:process/ns4:RequestModel");
                String requestAction = ((oracle.xml.parser.v2.XMLElement)requestActionXMLElem).getText();

                System.out.println("Request ID[" + reqId + "]Resource[" + resourceObject + "]Action[" + requestAction + "]Requester[" + requesterLogin + "]");
                System.out.println("Beneficiary[" + beneficiaryLogin + "]Manager[" + beneficiaryManagerLogin + "]Type[" + beneficiaryType + "]");

                Here is a sample of the data in the form submitted if you have the attribute Access Level and Job Role on your request dataset:

                String[] requestAttributes = new String[2];
                Object requestAttributesXMLElem = getVariableData("inputVariable","payload","/ns3:process/ns4:ObjectDetails/ns4:attributes[ns4:Name=\"Access Level\"]/ns4:Value");
                requestAttributes[0] = ((oracle.xml.parser.v2.XMLElement)requestAttributesXMLElem).getText();
                System.out.println("Access Level[" + requestAttributes[0] + "]");

                requestAttributesXMLElem = getVariableData("inputVariable","payload","/ns3:process/ns4:ObjectDetails/ns4:attributes[ns4:Name=\"Job Role\"]/ns4:Value");
                requestAttributes[1] = ((oracle.xml.parser.v2.XMLElement)requestAttributesXMLElem).getText();
                System.out.println("Job Role[" + requestAttributes[1] + "]");

                Everything is available in the payload, and you can use the enterprise manager to get the full values of the approval instance. This should give you a good starting point. When i work with custom approvals, if the values are in the payload, i retrieve them from there rather than running oim apis.