I tried to create Sitecore custom activity which appears on the Marketing automation control panel UI but does not call the invoke method when I pass the send sms service to it. If the invoke method does not have any services inside and only works with facets data (for example, retrieves contacts e-mail) the invoke method is being called and the action passes the campaign. Any ideas what could be wrong? I used sitecore.docs marketing automation documentation (https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/create-an-activity-type.html) for this. Thank you in advance!
2 Answers
The Marketing Automation Engine supports constructor dependency injection for custom activities. So to use a dependency in your custom activity, add a parameter to the constructor of your custom activity matching the type of the service you want passed in:
public class SymposiumReminder : IActivity
{
private IOtherService _otherService;
public SymposiumReminder(IOtherService otherService)
{
_otherService = otherService;
}
public ActivityResult Invoke(IContactProcessingContext context)
{
}
}
Also, make sure your dependency is available and has been registered to the Marketing Automation Engine application.
The problem was with the third party service DLL, it had to be copied to Automation engine folder.