My code for creating Automation Plan

var manager = ServiceLocator.ServiceProvider.GetDefinitionManagerFactory().GetDefinitionManager<IAutomationPlanDefinition>();

var currentTime = DateTime.Now;
var culture = CultureInfo.GetCultureInfo("en-US");
Guid planId = Guid.NewGuid();

Guid entryActivityGuid = Guid.NewGuid();

AutomationPlanDefinition plan = new AutomationPlanDefinition(planId, "later"+ planId, culture, "later plan", DateTime.UtcNow, "sitecore\\admin")
    ReentryMode = AutomationPlanReentryMode.Single,
    Description = "Later",
    EndDate = currentTime.AddDays(3),
    EntryActivityId = entryActivityGuid

Guid activityTypeGuid = Guid.Parse("51774DB5-B90B-4189-9613-104039723A0B");

var emailActivity = new AutomationActivityDefinition
    Id = entryActivityGuid, // ID of this instance
    ActivityTypeId = activityTypeGuid,
    Paths =
        {  "MessageId", Guid.Parse("E0D23B31-30E9-4F3F-AA98-826FD8F4A3A5")},


manager.SaveAsync(plan, true);

return plan.Id.ToString();

At this line manager.SaveAsync(plan, true);

I am getting this error:

$exception {"Postcondition 'the definition was not found: 14108e3c-8548-4339-baed-aa75add6be23 should be greater than 0' failed. The actual value is 0."} Sitecore.Framework.Conditions.PostconditionException"**

and 14108e3c-8548-4339-baed-aa75add6be23 is the id of automation plan.

How to solve this error?

  • Which version of Sitecore 9 do you use? Initial version or Update 1? Mar 21 '18 at 8:20
  • It is sitecore Update 1
    – Anik Saha
    Mar 21 '18 at 9:16

I have tried your scenario with exactly same code also on Sitecore 9 Update 1.

On my side everything went through without any problem as you can see on below images.

enter image description here

enter image description here

I think you haven't deployed marketing definitions in Control Panel and that is a root cause of your trouble.

What you can try to do:


Verify or try to redeploy marketing definitions from Control Panel:

enter image description here

enter image description here


Also try to rebuild marketing definition indexes through Indexing Manager from Control Panel:

enter image description here

I would contact Sitecore Support if the issue still persists.

  • ok I will try as you said.
    – Anik Saha
    Mar 22 '18 at 7:53
  • I tried it. I have two languages. Is that creating problem ?
    – Anik Saha
    Apr 3 '18 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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