Note that there are some explanatory texts on larger screens.

plurals
  1. POTridion Workflows - How to get the Component at the Activity in Event Handler
    primarykey
    data
    text
    <p>I need to get the component associated to a Activity at the event system.</p> <p>I try to get the component ID using:</p> <pre><code> public void OnActivityInstanceFinishPost(ActivityInstance activityInstance, string finishMessage, string nextActivity, string dynamicAssignee) { if (activityInstance.ProcessInstance.ProcessDefinition.Title.Equals("Component Process IESE")) { if (activityInstance.ActivityDefinition.Title.Equals("Create or Edit Component")) { WFE workflow = tdse.GetWFE(); try { Component comp = (Component)activityInstance.ProcessInstance.Item; XMLReadFilter filter = new XMLReadFilter(); String processHistoryId = activityInstance.ProcessInstance.ID.Replace("131076", "131080"); ProcessHistory hist = (ProcessHistory)tdse.GetObject(activityInstance.ProcessInstance.ID, EnumOpenMode.OpenModeView, Constants.URINULL, filter); } catch (Exception e) { } } } } </code></pre> <p>we try different options:</p> <pre><code> Component comp = (Component)activityInstance.ProcessInstance.Item; </code></pre> <p>But this solution returns a null.</p> <p>Then I found in internet the next solution:</p> <pre><code> XMLReadFilter filter = new XMLReadFilter(); String processHistoryId = activityInstance.ProcessInstance.ID.Replace("131076", "131080"); ProcessHistory hist = (ProcessHistory)tdse.GetObject(activityInstance.ProcessInstance.ID, EnumOpenMode.OpenModeView, Constants.URINULL, filter); Component comp = hist.Item as Component; </code></pre> <p>But the ProcessHistory object is null.</p> <p>How can I determine the component associated to the activityInstance?</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload