2

We have 2 groups 1) Group A [For editing content] {A1,A2,A3,X...} 2) Group B [For Approving content]{B1,B2,B3,X...}

If a User X is part of both groups A and B and edits some content, we don't want the approval activity to be assigned to user X, but it should be assigned to rest of the users of group B instead of entire group.

We are using Core services to finish the activity.

Code as below:

            LinkToTrusteeData nextAssignee = new LinkToTrusteeData();
            nextAssignee.IdRef = nextActivityAssigneeId;
            nextAssignee.Title = nextActivityAssigneeTitle;

            ActivityFinishData finish = new ActivityFinishData();
            var readoptions = new ReadOptions();
            finish.Message = finishActivityMessage;
            finish.NextAssignee = nextAssignee;

            _client.FinishActivity(currentActivityId, finish, readoptions);


Is there a way we can assign the next activity to list of users rather than assigning to a predefined group?

Tridion version : 2011 SP1, C# Core services.

Regards, Tarun Panwar

2
  • It seems you are impersonating users for this activity. Have you tried to put some customization (logic to exclude the users from both group) in current activity as you stated above, what problem you have faced? If your current activity is stopped or not finished, the next activity will not be triggered. Aug 12, 2015 at 7:47
  • Hi @Anupam Baksi , I've upadated the question mentioning how we are finishing the activity. Aug 12, 2015 at 8:24

1 Answer 1

3

For this requirement, the typical approach I see is to validate on Activity Start that the user is not the same as the previous user, and throw an exception if that's the case. You can (must?) use the Event System for this validation, and if you throw the exception on the Initialized phase then the activity will not start and the user in question will see the text of your exception.

UPDATE

Here's how it would work:

  1. On Activity Start, check if this is the "Approval" activity. If not, exit and do nothing.
  2. If it is the "Approval" activity, find who was the user who created/edited the content, and check if it matches the current user. If not, exit and do nothing.
  3. If the users match, throw an exception with text like "Content editors cannot approve their own content changes". The activity is not started and remains assigned to the group until someone else starts it.
6
  • We are able to identify if user is member of next activity via core services. Also if we throw exception then I think this will stop the workflow but we want workflow to be continued. Aug 12, 2015 at 11:42
  • 1
    If you throw an exception in event system before the activity is started you don't stop the workflow, you just prevent that activity from being started
    – Nuno Linhares
    Aug 12, 2015 at 12:02
  • In that case User X(Member of Editor and Approver group) will not be able to create/update content, which we want to avoid. We are looking for a way that he is able to edit the content but should not go to him as a part of Approval process. Aug 12, 2015 at 12:07
  • 2
    And that's why you would first check which activity the user is starting now. Approval gets routed to a group, and members of that group can start it. If it's the same user that tries to start it, you throw an error and tell him "sorry, you can't do this." If it's another user you don't say anything and the flow continues...
    – Nuno Linhares
    Aug 12, 2015 at 12:20
  • 1
    @TarunPanwar what Nuno is describing will not prevent the user from having the approval activity assigned to their group, but I don't think there's a way to do that. However, they will not be able to start the approval activity and will receive your custom error message from the Event System if they try. I think this should achieve what you need. Aug 12, 2015 at 12:39

Your Answer

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

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