Get the process instance ID

Hey,
I've build a Process DC with subprocesses. I would like to retrieve my process instance ID, this way, when I am in a subprocess, I could still put a link to the diagram of the main process !
Does anyone have any idea how to obtain it ?
Any help would be appreciated!

Hi Lynne,
another question. Did you get the funtion "sendNotification()" running? At line push.pushSharedItem(procon, item, users); I get the error "null null"
I already checked objects and they seems to be created correct. Might there be any attribute wrong due to the fact that this example is originally for CE 7.0?
//Setup connection
IUWLService uwlService = findService();
final int sessionIdleTimeout = 60;
UWLContext uwlContext = new UWLContext();
IWDClientUser clientUser;
clientUser = WDClientUser.getLoggedInClientUser();
IUser user = clientUser.getSAPUser();
uwlContext.setUser(user);
uwlContext.setLocale(Locale.getDefault());
IUWLSession uwlSession;
uwlSession = uwlService.beginSession(uwlContext, sessionIdleTimeout);
uwlContext.setSession(uwlSession);
IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);
//Setup provider conn
IPushChannel push = uwlService.getPushChannel();
IProviderConnector procon = uwlService.getRegisterProviderConnector(IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID);
IUserFactory usf = UMFactory.getUserFactory();
IUser sendToUser = usf.getUserByLogonID(wdContext.nodeNotifData().currentNotifDataElement().getUserId());
//Setup item
Item item = new Item(IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID,IProviderConnector.ADHOC_WORKFLOW_SYSTEM, "" + new Date().getTime(), sendToUser.getUniqueID());
item.setUser(sendToUser.getUniqueID());
item.setSubject(wdContext.nodeNotifData().currentNotifDataElement().getSubject());
item.setDescription(wdContext.nodeNotifData().currentNotifDataElement().getDescription());
item.setItemType(ItemType.UWL_ITEM_NOTIFICATION);
item.setCreatedDate(new Date());
// item.setDueDate(new Date());
item.setCreatorId(user.getUniqueID());
item.setStatus(StatusEnum.NEW);
item.setCompletedDate(new Date());
// External Type is used to filter the notifications according to
// application
item.setExternalType("UWLNotification");
//Send item
Set users = new HashSet();
users.add(sendToUser.getUniqueID());
// users.add("USER.PRIVATE_DATASOURCE.un:testuser1");
push.pushSharedItem(procon, item, users);
wdComponentAPI.getMessageManager().reportSuccess("Notification Sent");
Regards

Similar Messages

  • Get the Process Instance as a process variable

    Hi,
    is there a way on a Workflow Process to get the process instance in order to save it as a process variable (and then store it via a backend call).
    In other words: I have many processes designed via NWDS Process Composer and I'd like to get the process instance ID in order to save it for faster retrieval of the process in the NWA's Manage Process application.
    Thank you,
    Pietro.

    Does it work if the process instance is already created?
    Can you give me an example?
    I've put as the first step of every workflow a callback method that is executed that calls an RFC to confirm, backend-side, that the process has been created.

  • How to get the process instance key so as to retry a rejected task through api while ad provisoing?

    Hi All,
    How to get the process instance key so as to retry a rejected task through API while AD provisioing state?
    API URL - http://docs.oracle.com/cd/E27559_01/apirefs.1112/e28159/toc.htm
    Thanks

    To retry a task that is in a rejected state, you use the SCH_KEY which is the task key.  In OIM, all rejected tasks are listed in the OTI table.  It contains all the important information about a rejected or pending task.
    You can use the APIs found in the tcProvisioningOperationsIntf class to retrieve open tasks.
    -Kevin

  • Raised GPEngineException when runtime get the process instance

    Dear Ladies/Gentlemen:
    I have developped a guided procedure process, it pop up GPEngineException when it met the code like below.
    IUser userCurrentProcessorLogonID = UMFactory.getUserFactory().getUserByLogonID(wdUser.getSAPUser().getName());
    IGPUserContext currentProcessor = GPContextFactory.getContextManager().createUserContext(userCurrentProcessorLogonID);
    IGPProcessInstance lvProcessInt = rtm.getProcessInstance(processID,currentProcessor);
    I make sure the processID and userContext as parameters passed into rtm.getProcessInstance correctly.
    But I have no idea why it always pop up GPEngineException
    Hopfully you can help me.
    Thank you greatly.
    Regards
    Eric

    Hi,
    This could be the case if the current logged in user is not assigned the role in process or does not have the permission.
    Check in the logs(NWA) for exact problem. Also share the exception message.
    Refer below link for correct usage of gp API.
    https://cw.sdn.sap.com/cw/docs/DOC-113889
    Regards
    Deepak

  • How to get the activity instance id and process id

    Dear All,
    For my case, my boss require the workflow program processor can be runtime assigned . After research, I found the coding example like below:
    // dynamically assign a user to a role
    rtm.addRuntimeDefinedUserToRole(
                      // process instance
                      prInstance,
                      // role name
                      "Processor",
                      // user that is assigned (IUser)
                      user,
                      // user context (IGPUserContext)
                      userContext);
    // dynamically change the user assigned to a role for a particular task
    String prInstanceID = prInstance.getID();
    rtm.changeTaskProcessor(
                      // process instance ID
                      prInstanceID,
                      // activity instance ID
                      activityInstanceID,
                      // current user (IGPUserContext)
                      currentProcessorContext,
                      // new user (IGPUserContext)
                      newProcessorContext);
    But I don't know how to get the process instance ID and activity instance ID before I can apply this api in my webdynpro application.
    Any gentllement can give me an idea.
    Thank you.
    Regards
    Eric

    process =  GPProcessFactory.getDesigntimeManager().getActiveTemplate(
                                  // by specifying its ID "CCD2C3F1BED111DD9DFA005056A9416C",/
                                                 /* and the user accessing it */ userContext);
         //          retrieve the Runtime Manager
         IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
         // create an empty role assignment list
         IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();
         //Initialising the input params
         IGPStructure params =GPStructureFactory.getStructure(process.getInputParameters());
         params.setAttributeValue("Name",value);
         //Starting the process
         IGPProcessInstance prInstance = rtm.startProcess(process,"Process Name","Process name",user,roles,params,user);

  • How to get the all instances in which I acted on any of the activity?

    Hi all,
    Consider that in a Process there are three Activities named
    1. Create Proposal Role : Initiator
    2. Routed to Primary Owner Approval Role : Primary Owner
    3. Routed to Manager Approval Role : Manager
    Suppose I'm a Participant having access to PrimaryOwner Role. Some X, Y, Z persons created 3 instances whcih is now in "Routed to Manager Approval" activity or completed. I acted only on 2 instances and the other some one else acted. How can i get the 2 instances in which i acted . What is the way to acheive this PAPI 6.0 or Stuio 6.0?
    Thanks in advance,
    Sana

    Doing something similar, using following code in a screenflow called from a global activity:
    ps = new ProcessService();
    ps.connectTo(url :Fuego.Server.directoryURL, user : "username", password : "password");
    InstanceFilter filter = ps.getFilterFor(viewId : "myHidView");
    filter.searchScope = SearchScope(participantScope : ParticipantScope.ALL, statusScope : StatusScope.ONLY_INPROCESS);
    // have tried the filter using both methods below
    //filter.setParametricValueTo(variable : "myvar", value : myDesiredVarValue);
    filter.addAttributeTo(variable : "myvar", comparator : Comparison.IS, value : myDesiredVarValue);
    instances = ps.getInstancesByFilter(filter : filter);
    I get the following error in the engine log:
    Unable to receive the message because of a serialization error. Caused by: fuegoblock.papi.Instance fuego.rmi.spi.SerializationException: Unable to receive the message because of a serialization error. at fuego.rmi.spi.BaseConnection.send(BaseConnection.java:101) at fuego.rmi.ServerCluster.send(ServerCluster.java:226) at fuego.rmi.ServerCluster.sendResult(ServerCluster.java:495) at fuego.rmi.ServerCluster.access$400(ServerCluster.java:50) at fuego.rmi.ServerCluster$1.put(ServerCluster.java:590) at fuego.component.ExecutionThread.sendResult(ExecutionThread.java:523) at fuego.component.ExecutionThreadContext.doClientInvoke(ExecutionThreadContext.java:668) at fuego.component.ClientRemoteComponent.doInvocation(ClientRemoteComponent.java:303) at fuego.component.ClientRemoteComponent.invoke(ClientRemoteComponent.java:160) at fuego.component.ExecutionRelayedThrowable.execute(ExecutionRelayedThrowable.java:94) at fuego.server.execution.TaskExecution.handleExecutionRelayedThrowable(TaskExecution.java:802) at fuego.server.execution.TaskExecution.handleComponentExecutionException(TaskExecution.java:753) at fuego.server.execution.TaskExecution.executeCIL(TaskExecution.java:493) at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:677) at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:638) at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:451) at fuego.server.execution.GlobalTaskExecution.executeGlobalCIL(GlobalTaskExecution.java:164) at fuego.server.execution.Global.continueCil(Global.java:68) at fuego.server.AbstractProcessBean$39.execute(AbstractProcessBean.java:2515) at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:291) at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:462) at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:540) at fuego.transaction.TransactionAction.start(TransactionAction.java:213) at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:118) at fuego.server.execution.EngineExecution.executeImmediate(EngineExecution.java:66) at fuego.server.AbstractProcessBean.runGlobalActivity(AbstractProcessBean.java:2508) at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at fuego.lang.JavaClass.invokeMethod(JavaClass.java:1477) at fuego.lang.JavaObject.invoke(JavaObject.java:185) at fuego.component.Message.process(Message.java:585) at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:759) at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:734) at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:140) at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:132) at fuego.fengine.FEngineProcessBean.processBatch(FEngineProcessBean.java:257) at fuego.component.ExecutionThread.work(ExecutionThread.java:818) at fuego.component.ExecutionThread.run(ExecutionThread.java:397) Caused by: java.io.NotSerializableException: fuegoblock.papi.Instance at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at java.util.ArrayList.writeObject(Unknown Source) at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at fuego.component.Message.writeObject(Message.java:665) at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at fuego.component.Batch.writeObject(Batch.java:151) at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at fuego.rmi.Packet.write(Packet.java:251) at fuego.rmi.spi.BaseConnection.send(BaseConnection.java:98) ... 38 more
    Sorry for huge error message.
    Is there a trick to getting the filtered set of instances from in the screenflow activity?

  • Showing the process instance state.

    My application for material purchasing has two phases:
    1. the user fills an online request form (providing item, quantity, price, etc.) and the request is saved in the db;
    2. from within the application the user starts an approval process for his request.
    Still using this application, the user can later on look again at his request. Now I would like to show him the state of the process instance associated to it. The best for me would be to link, from my application, the same diagram shown by the Process List Viewer, with a green square on the activity in process.
    Is it possible? If yes, how?
    Thank you in advance.
    Livio

    Hi Harsha,
    the url you provided returns the following exception:
    The requested deployable object 'sap.com/tcbpemwdui~procvis' is not deployed on the server.
    I don't know if it's a matter of sw level. I am using NWCE EHP1 7.11 SP04. Do I need to upgrade to 7.2?
    Besides, I discovered that this url is working fine:
    http://server:port/bpem/pv/index.jsp?processInstanceId=<32_char_processinstanceID>
    Anyway, to have one of those url working I need to get the <32_char_processinstanceID> programmatically, but I don't know how. I searched through the documentation, but I didn't find anything.
    Can you, please, help me?
    I think that the functionality I am trying to privide to the end user is quite common.
    After filling an online form and after submitting it for approval, the user is extremely interested in the progress and in the final outcome of the process. Such information is provided by the Process List Viewer, where he can find, for example, the process instances he has started, but it's hard to correlate one instance with the request submitted. Searching through the requests is easier and is done with relational queries; from here it would be extremely useful to link any information about the state of the process instance.
    Can you please comment on this?
    Thank you.
    Livio

  • User assigned to the process instance

    How to get in an automatic activity in PBL code, the user assigned to the process instance.
    In other words, if a previous activity is this.participant.next = Participant.findByName ( "ereyes")
    in the activity that follows I want to get that user.
    Can I get one?

    Thanks Dan for responding.
    I need help to assign the variables that tell me, mySavedParticipantName.
    The design process is as follows.
    1 .- Begin Activity
    2 .- Begin activity is connected to an interactive activity in the PBL method with code only does a log "Interactive Activity".
    3 .- interactive activity is connected to the end activity.
    4 .- The interactive activity is connected by a "Due Transition" to an automatic activity.
    5 .- The automatic activity has a transition to the Interactive Activity
    6 .- The PBL code of automatic activity is executed when it meets the deadline of interactive activity. This code is where I need to know which user was assigned to the interactive activity.
    The stage of the process is as follows.
    A. - It creates a process instance.
    B. - User "Dan" is assigned the process instance but NO running interactive activity.
    C. - The automatic activity reaches its deadline.
    D. - Runs the code of automatic activity. and there need to know the user who was assigned, ie, the user "Dan"
    If the code did not execute interactive activity, how can I assign the variable mySavedParticipantName for automatic activity and has a value?.
    Thank you and hope you can help me.
    Greetings

  • Change the process instance state?

    Hi
    i am using PAPI WS ,
    the client side need to update the process instance ,as confirm or reject , so i need to update its state
    How can i do such this scenario?
    Thanks

    Since your query is resulting the correct result when you run it directly.
    It confirms that Issue is not with the Query.
    Also DB adapter will do nothing and only create a equivalent XSD for your query. So this also confims that Issue is not with the DBadapter.
    Kindly recheck the BPEL invocation of DB adapter and also check if anywhere in between process is getting the exception. Because All Tech adapters runs in the Main thread and will rollback automatically in case of Exceptions.
    So check your BPEL process once again.
    Regards,
    Ashutosh Singh

  • Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off

    I am on Oracle 11.1.1.7 BPM suite on W8 64 bit. I can't launch the flow trace and get the error "Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off".  I have set the audit level to development at the soa-infra>SOA Administration> Common Properties > Audit level set to development and Capture Composite Instance State is Checked.
    Can somebody advice.
    Thanks

    Can you please confirm me the following steps...
    Log in to the EM console, Expand soa-infra (soa_server1) , go to the partition where your composite is been deployed, Click on your composite, On the right, click on the dropdown Settings and choose Composite Audit Level. you can choose to set the Audit Level for this composite. If you choose Inherit, it will take the settings to what the server is being set to. Otherwise, we can override it by choosing Off, Production, or Development.
    Make sure your setting for that composite is not Off, keep inherit or production or development.
    Thanks,
    N

  • How to get the process id of a sql statement or a session  ....

    How to get the process id of a sql statement or a session . ..?
    Thanks

    What about this?
    SELECT pid
      FROM v$session s, v$process p
    WHERE p.addr = s.paddr
       AND s.sid = :sid;   -- replace :sid with your session idRegards.
    Al

  • OIM - Task Assignment Adapter - How to get the object instance key?

    Hello experts,
    I'm trying to use a task assignment adapter to assign an approval task dynamically. Basically, the user can request a resource like "CustomApp Profiles" and we create an object form to let them choose the profile that he needs. Each profile has an owner, which is populate in a Lookup (Owner is the code and Profile is the decode).
    So, in the approval task, I need to get the profile selected by user in the object form and search into the lookup who is the owner of that profile. But I don't know how can I get the object instance key using the parameters that can be mapped to a task assignment adapter.
    Looking into the OIM documents, I believe that the easier way is using the request key, because the REQ_KEY is a foreign key in OBI table.
    Did anyone knows how can I get the object instance key using the request key? Can I use some API or should I execute a SQL statement directly in OIM database?
    Best Regards,
    Nitto

    To retry a task that is in a rejected state, you use the SCH_KEY which is the task key.  In OIM, all rejected tasks are listed in the OTI table.  It contains all the important information about a rejected or pending task.
    You can use the APIs found in the tcProvisioningOperationsIntf class to retrieve open tasks.
    -Kevin

  • BPM an Mapping: Get the workflow instance number?

    Hi everybody,
    wen need in some cases the message-ID that was generated in message-mapping.
    But when I take this message-ID and try to find it via SXMB_MONI the message could'nt be found due to reasons I do not know.
    So now I would like to capture the BPM instance number. Is this possible in message-mapping?
    Thanks regards
    Mario

    I doubt you would be able to get the BPM instance no. However, I don't understand why u r facing problem with message ID.
    Regards,
    Prateek

  • Purchasing : Can we get the vo instance of retained AM true

    Hi,
    i need get the VO instance which is shuttled with one AM, but the PageLayout region of page having another AM which does not getting extended with any AM. but when i see in "about this page" link,
    page showing both AM's in the return AM list.
    retained AM list:
    oracle.apps.po.document.server.DocumentAM
    oracle.apps.po.tax.server.TaxAM
    oracle.apps.zx.taxintegration.appinteg.server.MaintainDetFactorsAM
    Used Code:
                      DocumentAMImpl localDocumentAMImpl=(DocumentAMImpl)paramOAPageContext.getApplicationModule(paramOAWebBean);
                      OAViewObjectImpl localOAViewObjectImpl1 =(OAViewObjectImpl)localDocumentAMImpl.findViewObject("PoHeaderMergeVO");
                      if(localOAViewObjectImpl1!=null)
                          GECMLogUtil.log(paramOAPageContext,"PoHeaderMergeVO Object Found");
                          localOAViewObjectImpl1.getCurrentRow().setAttribute("NoteToVendor",localOAViewObjectImpl.getCurrentRow().getAttribute("NoteToVendor")+" ");
                          GECMLogUtil.log(paramOAPageContext,"Appended space to note to vendor");
    Error Facing in page:
    ## Detail 0 ##
    java.lang.ClassCastException: oracle.apps.zx.taxintegration.appinteg.server.MaintainDetFactorsAMImpl cannot be cast to oracle.apps.po.document.server.DocumentAMImpl
    Could you please tell me how to get the VO instance.
    Regards,
    Ram

    Hi Gurus,
    Can anyone please reply for the above qstn whether we can get the vo instance for retained AM true?
    Regards,
    Ram

  • Is there any java api available to get the process identifier ?

    Hai,
    I am in need to get the process identifier of a running process.
    Is there any API available or any shell script which can be used in exec command
    to get it.
    Thanks in Advance.
    Kavitha M.

    Hint: Don't use the exec command! This would spawn off a new shell with a different PID. You might want to look at JNI (Java Native Interface) to attach a piece of C code to your Java application that can find out the PID.

Maybe you are looking for