I am using the below AMPScript but its not updating in SFDC -

%%[var @sflead, @Subskey 
set @sflead = UpdateSingleSalesforceObject('Lead',%%_subscriberkey%%,'OptOut','true') 

It works when I hardcode the value of subscriber key but not without that. I have tried many other ways but not working.

1 Answer 1


in AMPScript you do not add the "%%" to the personalization string call. That is only in raw HTML. (ref)

Personalization strings that appear in AMPscript function calls cannot include the surrounding percent symbols. For example, this code in AMPscript is invalid:


This format, however, is valid:


This should work:

%%[var @sflead, @Subskey 
set @sflead = UpdateSingleSalesforceObject('Lead',_subscriberkey,'OptOut','true') 
  • I tried that again but didn't work. I am using this script in a Cloud Page. Does that make a difference?
    – Maneesh
    Jun 14, 2016 at 21:21
  • Have you verified the subscriber key in SFMC matches the unique ID in SFDC? By default SFMC uses email address as subscriber key Jun 15, 2016 at 0:10
  • I think there is something else wrong. What you suggested is correct. I tested it on my emails. Somehow on Cloud Page, the personalization is not working.
    – Maneesh
    Jun 15, 2016 at 12:02
  • oh I completely didnt see that. Yes on cloud pages, you will need to use the MicrositeURL AMPScript (code.exacttarget.com/content-scripting/ampscript/sites/…) in order to pass attributes, etc of the subscriber to the landing page. Otherwise they will need to be passed via paramaters in the URL. Jun 15, 2016 at 12:17

You must log in to answer this question.

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