function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Manish Tripathi 20Manish Tripathi 20 

Not able to update sale cloud field From marketing cloud landing page using ampscript fnction.

I am not able to update the sales cloud filed dynamically from the marketing cloud using amp script on the landing page.

%%[

/* SET @emailAddress = requestparameter("Email") */
set @SubKey= 'a0Q2w0000033pY9EAI'
/*set @SubKey= requestparameter("BUI_RecordID")*/
set @jid= requestparameter("jobid")
set @listid= requestparameter("listid")

 SET @lue = CreateObject("ExecuteRequest")
 SetObjectProperty(@lue,"Name","LogUnsubEvent")

 SET @lue_prop = CreateObject("APIProperty")                 
 SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
 SetObjectProperty(@lue_prop, "Value", @SubKey)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)

 SET @lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@lue_prop, "Name", "JobID")
 SetObjectProperty(@lue_prop, "Value", @jid)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)

 SET @lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@lue_prop, "Name", "ListID")
 SetObjectProperty(@lue_prop, "Value", @listid)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)

/*
 SET @lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@lue_prop, "Name", "BatchID")
 SetObjectProperty(@lue_prop, "Value", @batchid)
 AddObjectArrayItem(@lue, "Parameters", @lue_prop)
*/

 SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)

 SET @Response = Row(@lue_statusCode, 1)
 SET @Status = Field(@Response,"StatusMessage")
 SET @Error = Field(@Response,"ErrorCode")

  
    IF LENGTH(@SubKey) == 18 AND IndexOf(@SubKey, "@") == 0 THEN
      /*  SET @updateRecord = UpdateSingleSalesforceObject("Contact", @SubKey, "HasOptedOutOfEmail", 0)*/
        SET @updateRecord = UpdateSingleSalesforceObject("abc__c", "a0Q2w0000------", "Name","Test")
        SET @updateRecord = UpdateSingleSalesforceObject("abc__c", "a0Q2w000-------", "Opt_Out__c", "true")
        
        
    ENDIF
]%%
SwethaSwetha (Salesforce Developers) 
HI Manish,
You can reach out to Marketing Cloud page on https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000001pQ5CAI  for inputs on your ask.

You can also log a case with Salesforce support 
Link: https://help.salesforce.com/articleView?id=workcom_contact_support.htm&type=5
 
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you