shailendrasinghpatil_7332

How to pass parameter to UC4 workflow from JAVA API

Discussion created by shailendrasinghpatil_7332 on Jan 15, 2016
Hi,
I am trying to kickstart an UC4 workflow using Java API. But I need to pass certain custom variables to the workflow so that workflow can read those variables and act on it.
I do not know the correct way to achieve this. 
I tried extending ExecuteObject request class and overrode the createRequest method and added my variables in the paramElement of the createRequest. Then I set the TraceListener on the connection object and printed the outbout request, I could see the variables in the request.

Here is the snippet:

public class MyExecuteRequest extends ExecuteObject{
public MyExecuteRequest(UC4ObjectName arg0) {
               super(arg0);
          }

          @Override
          protected void createRequest(XMLDocument paramXMLDocument, Element paramElement, ConnectionAttributes paramConnectionAttributes){
               paramElement.setAttribute("SIM_RUNID", "1232131321");
               super.createRequest(paramXMLDocument, paramElement, paramConnectionAttributes);               
          }

     }

//This is how I'm starting the workflow
final MyExecuteRequest request = new MyExecuteRequest(new UC4ObjectName("JP.UT.APP_MONITOR1"));
          connection.sendRequestAndWait(request);
          System.out.println(new Date(System.currentTimeMillis()) + " request id is" + request.getRunID());

Can anyone tell me how to read the variables passed in the request to the UC4 workflow? In this case I am passing SIM_RUNID with the request and I want to read it in the workflow.

Thanks in advance.

Outcomes