3 Replies Latest reply on Oct 30, 2014 8:02 AM by Scott Corbett

    Workflow

    ravi Expert

      Hi,

       

      I am in the process of learning workflows through customization pdf.Could anyone let me know the terms eventtype,eventsource and contextobject in detail,and relation between them.

       

      Thanks,

      Ravi.

        • Re: Workflow
          Scott Corbett Master

          Hi Ravi,

           

          The event type refers to the workflow event that is being called. For instance, an event type can be when your approvable gets Approved. You’d really only be defining these for eForms, as you should not be creating events for Ariba defined approvables. The event type can also be referred to in the CreateDurableEvent Action. So for instance, once your approvable enters the Approved state, you may want to define an action perform further processing of the approvable. In this case, you’d also fire the CreateDurableEvent Action and it takes the parameter “EventType” where you’d refer to the Approvable:Approved.

           

          The eventSource is something that would very unlikely that you’d ever have to define in a workflow extension or in an eform workflow. But it’s a type of Action. In fact eventSource is a subclass of Action. It’s used as an event action to listen to another type of object related to the object that is being workflowed. For example when workflowing an Invoice or charge, an event may want to operate on the related Reconciliation object.

           

          The contextObject is the object on which a given action will take effect on. So in workflow, it’s the approvable object that is the default contextObject (ex: a Requisition or Receipt, etc.). You don’t need to specify this in the code as it’s the default. If however you want the context to be the object that triggered the event, you need to specify the contextObject as EVENT_SOURCE. It’s very rare that you’d ever have to define contextObject, but it’s good to know what it is. In your Action java code, the correlation to the contextObject is the ValueSource which is passed into the fire method. Typically you’d check the ValueSource is an instanceof the object type you’re expecting, then operate.

           

          Hope that helps,

          Scott

            • Re: Workflow
              ravi Expert

              Hi Corbett,

               

              Thanks!

              I need a clarification.

              Eventsource:

              Example:

              when we are working on the requisition workflow, requisition object is taken as default workflow object.if we want any other object such as order in the requisition workflow we will use event source.am i getting it right?

               

              ContextObject:

              Statement:

              If however you want the context to be the object that triggered the event, you need to specify the contextObject as EVENT_SOURCE.

              Example:event type=Requsition:Approved.

              In this case some backend java class context triggered this event as Requisition:Approved.so if we want to use the backend java class which triggered this event as object we use the context object.am i getting it right?

              Could you please provide an example syntax on how to use it.

               

              Thanks,

              Ravi.

                • Re: Workflow
                  Scott Corbett Master

                  Hi Ravi,

                   

                  The documentation on eventSource indicates that this is used when there are related documents and it listens for events on those documents. So it's not to be used to get other objects per se, rather it's used to listen to related objects. The relationships are things like Requisition to PO, or ContractRequest to Contract, or Invoice to InvoiceReconciliation. Again, I've never run into a scenario where I've had to use it. To get other objects, just write a regular action and use the methods available to obtain those objects.

                   

                  On ContextObject EVENT_SOURCE, again I've never had to pass EVENT_SOURCE into my actions. But say you had a change on an Invoice that you wanted to trigger an event on the InvoiceReconciliation, you'd define your action trigger java implementation, then add contextObject="EVENT_SOURCE". So <action implementation="some java reference" contextObject="EVENT_SOURCE">. This changes the Action's valuesource object to that of the event source. Again, unlikely you'd need to ever do this.