3

I have a custom activity type in Marketing Automation that is being processed correctly in the MA journey, however I am unable to retrieve a custom facet from the IContactProcessingContext in the Invoke() method.

The custom facet is configured in xConnect and, as far as I can tell, the relevant JSON models and DLLs are deployed. xConnect collects and stores the facet with no issues and I can see the custom facet data in an xConnect ODATA query.

On the Automation Engine I have:

  • Model DLL in automation root
  • Activity type DLL in automation root
  • Activity type registration XML in {root}\App_Data\Config\sitecore\MarketingAutomation
  • Collection Model registration XML in {root}\App_Data\Config\sitecore

Both of the XML files have the filename format sc.xxxx.xml as per here The model registration XML is being picked up by the engine because I made a change and it errored on startup.

Sitecore version 9.1 initial release. Running local dev environment.

Model registration is as per below:

<Settings>
    <Sitecore>
        <XConnect>
            <Services>
                <XConnect.Client.Configuration>
                    <Options>
                        <Models>
                            <CustomModel>
                                <TypeName>Foo.Foundation.Models.xConnectModels.CollectionModel, Foo.Foundation.Models</TypeName>
                            </CustomModel>
                        </Models>
                    </Options>
                </XConnect.Client.Configuration>
            </Services>
        </XConnect>
    </Sitecore>
</Settings>

Facet retrieval in Activity Type:

string memberFacetKey = Foo.Foundation.Models.xConnectModels.MemberInfo.DefaultFacetKey;
string personalInfoFacetKey = PersonalInformation.DefaultFacetKey;

//Null result:
MemberInfo memberInfoFacet = context.Contact.GetFacet<MemberInfo>(memberFacetKey);

//Results returned:
PersonalInformation personalInfoFacet = context.Contact.GetFacet<PersonalInformation>(personalInfoFacetKey);

Any suggestions as to what I need to do in order to get the Automation Engine to find the custom facet ?

1 Answer 1

5

The Marketing Automation engine requires you to define custom facets that will be available when the contact is evaluated. You will need to patch in your custom facet to the IncludeFacetNames section of the sc.MarketingAutomation.ContactLoader.xml config

You would need to add the MemberInfo facet to the IncludeFacetNames. You could create a patch file sc.(patch name).xml and it would look something like this:

    <Settings>
<!--
   Marketing Automation contact loader configuration
-->
<Sitecore>
   <XConnect>
   <MarketingAutomation>
       <Engine>
       <Services>
           <MarketingAutomation.Loading.ContactFacetsConfigurator>
           <Options>
               <IncludeFacetNames>
                    <MemberInfo>MemberInfo</MemberInfo>
               </IncludeFacetNames>
           </Options>
           </MarketingAutomation.Loading.ContactFacetsConfigurator>
       </Services>
       </Engine>
   </MarketingAutomation>
   </XConnect>
</Sitecore>
</Settings>

Further Documentation is provided in the "Ensure facets are loaded" section https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/create-an-activity-type.html

1
  • Thanks George, that was the final piece to get it working.
    – andyp
    Commented May 14, 2019 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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