1

I was trying to update account object through ampscript using UpdateSingleSalesforceObject this function,the result is returning zero value,is their any permission is need to be provided for accessing/updating object in sfsc?

9
  • Can you please share your code so we can help you understand better what it is your trying to do? You may have issues within your AMPscript first before checking the account object in the CRM Nov 24, 2019 at 4:46
  • %%[ set @result = UpdateSingleSalesforceObject('Account','00Q00003yAEj','Email','[email protected]') ]%% %%=v(@result)=%%
    – shiva dn
    Nov 24, 2019 at 4:53
  • Even i have tried with removing quotes for id field then also facing same issue
    – shiva dn
    Nov 24, 2019 at 4:54
  • Are you changing the ‘Id’ value to the relevant record you want to update? That Id looks to be only 12 digits... is that the example Id from the documentation? Nov 24, 2019 at 4:57
  • I took the id value for the particular record in the account object and trying to update
    – shiva dn
    Nov 24, 2019 at 4:58

1 Answer 1

7

First of all, try to wrap your whole script in a try/catch statement, this will help you debug AMPscript in case there is an error.

<script runat="server">
  Platform.Load("Core","1.1.1");

  try{

</script>

%%[

  set @id = "00Q00003yAEj"
  set @email = "[email protected]"
  set @updateRecord = UpdateSingleSalesforceObject(
      "Account",@id,
      "Email", @email
     )

]%%

Status: %%=v(@updateRecord)=%%  

<script runat="server">
  }catch(e){
    Write(Stringify(e));
  }
</script>

And now why above won't work?

  1. You said that you wanted to update an Account, but you are clearly using a Lead Id in your script (lead Ids start with 00Q, while account Ids would start with something like 001). Make sure that you are using the correct object with the correct Id.
  2. There is no way that the Id is 12 digits long. It's always either 15 or 18, but never 12 digits. Please check the Id and make sure that you are using the correct one.

You must log in to answer this question.

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