I have trouble on AMPScript(newbie on this functionality), on my cloudpage I ask for 2 optin with checkbox. So you can have check both or only one of the two.

Regarding the result, I want to get back the tick into CRM. Could you please help me with his issue? My lookup are working but not my logic with updatesinglesalesforceobject

    %%[ var @updatemail, @updatetel,@optinemail, @optintel, @contactid

SET @optinemail = Lookup("Optin_Formulaire","HasOptedOutOfEmail","ID", @contactid)

IF @optinemail = 1 THEN 
SET @updatemail = UpdateSingleSalesforceObject('Contact', 'ID', 'HasOptedOutOfEmail', 'True')

SET @optintel = Lookup("Optin_Formulaire","HasOptedOutOfMobile","ID", @contactid)

IF @optintel = 1 THEN 
SET @updatetel =
 UpdateSingleSalesforceObject('Contact', 'ID', 'et4ae5__HasOptedOutOfMobile__c', 'True')
  • It's a bit difficult to disentangle, but a couple of points. 1. You can lookup a Data Extension and retrieve multiple fields in a single go using LookupOrderedRows. 2. The logic you'll have to help us with... If I'm opted out in this table go opt me out in CRM. I'm presuming the "Optin_Formulaire" table has stuff in it that reflects what's probably in CRM anyway? So the logic's I'm opted out, so opt me out? – Macca May 6 at 14:10
  • Thanks Macca for your answer. I'll look to LookupOrderedRows. The "Optin_Formulaire" table have 2 boolean fields HasOptedOutOfEmail & HasOptedOutOfMobile. If one of them (or both) are true, I want to update fields in the CRM (only optin and not optout) it's why I am using the IF Statement – Elodie May 6 at 14:18
  • Is this in the context of a resubscribe page? – Macca May 6 at 14:31
  • No, it's to get optin after they buy one of our product. As they are new, we don't want to take the optout (I now it's strange but it's my usecase) – Elodie May 6 at 14:36

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.