Pass a parameter to a Kentico Marketing Automation workflow

89 Views Asked by At

How do I pass a parameter to a Marketing Automation workflow?

I need to pass a parameter called 'MeetingId' to the workflow 'MeetingInvitation'. How can I do that?

        ContactInfo contact = ContactInfoProvider.GetContacts()
                                                    .WhereEquals("ContactEmail", "[email protected]")
                                                    .TopN(1)
                                                    .FirstOrDefault();

        // Gets the marketing automation process
        WorkflowInfo process = WorkflowInfoProvider.GetWorkflowInfo("MeetingInvitation", WorkflowTypeEnum.Automation);

        if ((contact != null) && (process != null))
        {
            // Creates an automation manager instance
            AutomationManager manager = AutomationManager.GetInstance(MembershipContext.AuthenticatedUser);
           
            // Starts the process for the contact
            manager.StartProcess(contact, process.WorkflowID);
        }
1

There are 1 best solutions below

0
On

I don't think you can pass this as a parameter inside marketing automation process with a code like this. The only way you can pass something into MA process is through the trigger data if the trigger is set to activity. Please refer to this blog article for example, basically it showcases how you can start MA process after form submission and get form submission data inside MA process.

You would need something similar I guess:

  • configure your MA process to be run on activity type of a trigger
  • in your code rather than starting the process explicitly, you can issue this type of activity for the contact, including your ID in ActivityDetailItemID parameter
  • by this issued activity Kentico will start MA process automatically and inside this MA process you can access activity details with required data