Sitecore EXM 3.3: How do I pass and retrieve custom, non-contact data?

346 Views Asked by At

Sitecore 8.1 update3
EXM 3.3
MVC

When sending campaign emails we are able to use custom tokens which are part of a contact's facet, and use personalization in a custom page for the specific recipient being processed, but we are completely lost as to passing data, which is not part of the recipient 's profile, into a custom component.

The goal is to be able to create an api which can be called from an outside application which will fire off an email. The api will pass through some input, and we can pick that up in the MVC controller for use in building our model.

Any chance anyone out there has tried anything like this?

As always, thank you for guidance.

1

There are 1 best solutions below

2
On

I think the better way is to work with native Sitecore approach: use Sitecore contacts's facets. You are able to extend them and save everything there.

If you need quick way then you can put you custom data to user's profile(of course if contact have identifier to get user) and access to user's profile in your email:

var user = Sitecore.Security.Accounts.User.FromName(Request["ec_recipient"].Replace("sc:", ""), false)
var yourData = user.Profile.GetCustomProperty("dataPropertyName");