I would like to perform an update on the Lead Object in Salesforce as soon as the relative Marketing Cloud Subscriber perform the unsubscribe via Mobile SMS in Marketing Cloud. I tried using Ampscript and an automation Script using SSJS. Do you have about I could achieve?

Thanks, Stefano

2 Answers 2


You can simply add AMPScript directly to the Unsubscribe Response SMS that updates the Lead Record using the function UpdateSingleSalesforceObject.

  • Hi Zeli, yes I tried, but it didn't work. I have a 320 char limits and it seems not able to read the ampscript.
    – Stefano
    Nov 17, 2017 at 13:32
  • Are you sure ? I remember doing this hack last year for one of my clients. If you have character limitation, try to put your AMPScript in a Content Block and then Invoke it with ContentBlockbyId function.
    – zeljazouli
    Nov 17, 2017 at 13:44
  • You are the man! I removed the first part of the script (the <> ones) and it seems to go. Now I need to understand how can I get the mobile Contact key (which is the LeadId in Salesforce)...
    – Stefano
    Nov 17, 2017 at 13:54
  • Your mobile contact key is your subscriber key ? Try using %%subscriberkey%% more info : help.marketingcloud.com/en/documentation/exacttarget/content/…
    – zeljazouli
    Nov 17, 2017 at 14:04
  • Here is what I tried but it didn't work %%[UpdateSingleSalesforceObject('Lead',_subscriberkey,'et4ae5__HasOptedOutOfMobile__c', 'false')]%%
    – Stefano
    Nov 17, 2017 at 14:18

SubscriberKey isn't exposed in Mobile Connect. We usually create a 2nd version of it as an attribute to use for lookup functions. do you have any other variables to use for a lookup to expose the SubcriberKey? This is the same across MobileConnect & MobilePush.

  • Hi! actually I've noticed that we are not able to get the contactId also, so we are trying to understand why. Do you have any Idea?
    – Stefano
    Nov 21, 2017 at 9:00
  • Neither ContactID or ContactKey are exposed as attributes, you need to use a mobile connect attribute to then lookup against
    – OMSP
    Nov 28, 2017 at 1:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .