Sitecore Marketing Automation Custom Predicate woes
TL;DR: If you are getting “No predicate descriptor was registered with Id ‘9f3a44f4-179a-4d19-8583-14a8874e5bba’” in your Automation Engine log, make sure your XML definition file is prefixed with “sc.”
I recently needed to create some custom predicates for Marketing Automation in Sitecore 9.0. Sitecore has made a decent attempt at documenting what you need to do, but it is quite lacking in one specific area.
After you have created your new class and inherited from ICondition (don’t worry about IContactSearchQueryFactory. It is not specifically mentioned, but for Marketing Automation rules you only need ICondition) you need to copy the DLL file that contains your custom predicate to the Automation Engine in this location: XConnectFolder\App_data\jobs\continuous\AutomationEngine. You also need to create an XML file for Automation Engine which contains the ID of the condition description you have created in Sitecore /sitecore/system/Settings/Rules/Definitions/Elements/My Rules/Custom Rule/MyCustomPredicates.xml, as well as the name of your class that inherits from ICondition.
Now you might think you are ready to use your rule in Marketing Automation, but you might experience the following exception in the Automation Engine log file:
An error occurred during activity invocation for activity ‘890dc014-8e70-b4b4-d15a-6cc837f7c11a’ in plan ‘2667589a-34b9-4f98-aad3-6d3f3075c8d6’ DescriptorId : 9f3a44f4-179a-4d19-8583-14a8874e5bba Sitecore.XConnect.Segmentation.ExpressionBuilder.PredicateDescriptorException: No predicate descriptor was registered with Id ‘9f3a44f4-179a-4d19-8583-14a8874e5bba’.
You may have done like me, and followed the instructions in the documentation to the letter, but still you are getting this error.
This is simply because the documentation is missing a few letters!
The XML file you have created must be prefixed by sc., so that if you named your original file MyCustomPredicates.xml it should really have been named sc.MyCustomPredicates.xml
Due to the documentation missing this information, it is very hard to find the actual solution. My question on StackExchange yielded no answers and I had to contact Sitecore Support to get to this simple solution.
So, to conclude, be sure to prefix your Custom Predicate XML files with sc. to avoid the aforementioned error.
According to Sitecore Support, when you have deployed your XML and DLL files to Automation Engine, you actually do not have to restart the Automation Engine Windows Service. It will pick up new DLL and XML files while running.