1

We are trying to customize the EXM preference centre by calling an additional AJAX in the Preference Center Java Script

For this we have created a controller action:

public class EXMPreferencesController: Controller
{
        [HttpPost]
        public JsonResult getcontact(object Preferences, string EncryptedContactIdentifier)
        {
            // some code
            return Json("ok");
        }
}

and appended the below AJAX in submitPreferences function in javascript. So that this AJAX will hit on click of the Update subscription button on the Email Preference Center page.

$.ajax('/api/sitecore/EXMPreferences/getcontact', {
                    method: 'POST',
                    contentType: 'application/json',
                    processData: false,
                    data: JSON.stringify({
                        "Preferences" : preferences,
                        "EncryptedContactIdentifier": contactIdentifier
                    })
                }).then(formSuccess, formFail);     

enter image description here AJAX is getting triggered, but how can we get current contact information like contact ID, contact identifier from EncryptedContactIdentifier variable in action method.

Any help is much appreciated?

2
  • I think you can get contact ID from the current sitecore context. Otherwise , it is possible to call into sitecore's encryption code to decrypt this - you'll need to find it in dotpeek / ILspy. Aug 29 at 23:59
  • @MarkGibbons Thanks, I think I found a way to decrypt using Sitecore.Modules.EmailCampaign.Core.Crypto.IStringCipher class. Aug 30 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.