I have a requirement where I want to set the expiration time of the next activity or change the expiration time of that activity from my code dynamically. Is it possible ?
For Information: I am using Tridion 2013 sp1.
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have implemented the code using Tridion.ContentManager.CoreService.Workflow and there are 2 properties called -
public DateTime? DueDate { get; set; }
Under ActivityData
classpublic DateTime? NextActivityDueDate { get; set; }
Under ActivityFineshData
classone can update the Expiration Time of an activity from code by set the value of DueDate property dynamically.
Using NextActivityDueDate also can control the expiration time from previous activity. Sample Code -
CoreServiceClient.FinishActivity(ActivityInstance.Id, new ActivityFinishData { Message = "Mail Sent to Target Audience, Finished Activity", NextActivityDueDate = System.DateTime.Now.AddMinutes(5) }, null);
But make sure that the Allow to override due date(refer below screenshot) check box is checked. Otherwise it will throw an error -
DueDate property can't be updated manually, when it's restricted by activity definition.
I don't have a working code snippet but it looks possible using TOM .NET, with little modification, based on the following online documentation.