1

I am triggering a workflow on a component X by updating the component values.

In my C# External Activity class i am trying to get the changed value from the above component.Each time i am getting the old value. Workflow version of item is not coming in External Activity.

How can i get the workflow version of Component in External Activity C#. Do i need to manually create the workflow version of component?

Reading of Data :

ComponentData component =  
(ComponentData)CoreServiceClient.Read(ActivityInstance.WorkItems[0].Subject.IdRef, new     
ReadOptions());

This is how i am reading the workflow component.

Publish the Page :

PublishItem publishItem = new PublishItem();
PublishInstructionData publishInstruction = new PublishInstructionData
{
    ResolveInstruction = new ResolveInstructionData()
    {
        IncludeChildPublications = false,
        IncludeWorkflow = true
    },
    RenderInstruction = new RenderInstructionData()
};
publishItem.Publish(CoreServiceClient, publishInstruction, new String[] { pageTCMUri }, new String[] { previewTarget }, PublishPriority.High);

Just now i checked that new value is getting published to staging as expected.But i want to execute some logic on basis of changed value in component in External Activity.

4
  • There might be plenty of reasons for this to happen. Could you please post the code of your external activity? Apr 7, 2014 at 10:50
  • updated the question Apr 7, 2014 at 11:08
  • Can you confirm that component variable has no changes? Apr 7, 2014 at 11:16
  • component variable has no changes . Apr 7, 2014 at 11:20

4 Answers 4

1

It happens when the Component Approval Status doesn't match the Publication Target Approval Status. If your Activity is setting the Approval Status to the same Approval Status as the Publication Target make sure that you are finishing (Applying the Approval Status) before you publish

0

According to: this There's no ActivityInstance variable predefined, so I assume you have created it yourself and it might be the case that it's not correct. Try using CurrentActivityInstance instead.

Try this:

(ComponentData)CoreServiceClient.Read(CurrentActivity.WorkItems[0].Subject.IdRef‌​, new ReadOptions());
3
  • This is what i have used ActivityInstance and it is a defind variable . I have not created it . ActivityInstanceData currentactivity = (ActivityInstanceData)CoreServiceClient.Read(ActivityInstance.Id, new ReadOptions()); ComponentData component = (ComponentData)CoreServiceClient.Read(currentactivity.WorkItems[0].Subject.IdRef, new ReadOptions()); Apr 7, 2014 at 11:43
  • Try this (see my update). Also, do you have just 1 component in the workflow? Apr 7, 2014 at 11:45
  • Yes, i have only one component in workflow. In your line of code CurrentActivity is undefind. Apr 7, 2014 at 11:46
0

Not sure exactly for your case, but for getting dynamic version you need specify UseDyncamicVersion condition. If I am not mistaken default behavior - load major version(DynamicVersionResolvingConditions.None).

 ComponentData component =  
            (ComponentData)CoreServiceClient.Read(ActivityInstance.WorkItems[0].Subject.IdRef,
     new ReadOptions()
                {
                  UseDynamicVersion = DynamicVersionResolvingConditions.CheckedOutByUser
                });
0

This can be caused by using a different identity for your core service access than you are using to view the item in the GUI. The workflow version of an item is only displayed to the assignee that actually has the item in workflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.