I'm trying to create a custom Salesforce object (in the Salesforce account integrated with my Marketing Cloud account) when people visit my Marketing Cloud landing page.

However I keep getting a 500 error on the page.

I have one variable in the Create Salesforce Object string which I've already set on the page. I've also used that variable to pre-fill a field in a smart capture form on the page, I've tested that bit and its working.

  • The Custom object name is: NPS_survey (or API name: NPS_Survey__c)
  • The record Type ID is: 012w0000000V749AAC
  • The variable ordinal (field: NPS_Survey__c:Account_Name__c) is: ContactName
  • I want to fill the NPS_Survey_Score__c field with the '1'

Here's what i have:

%%[ var @id
set @id=CreateSalesforceObject("NPS_Survey", 3,
"NPS_Survey_Score__c","1") ]%%

I've tried different variances of the variable, such as including/not including quotation marks, the =/@/v signs etc with no luck.

  • 1
    You don't need the v() function since you are already in an Ampscript block. Try: %%[ var @id set @id=CreateSalesforceObject("NPS_Survey",3,"RecordType","012w0000000V749AAC","NPS_Survey__c:Account_Name__c",@ContactName,"NPS_Survey_Score__c","1") ]%% Commented Jun 9, 2017 at 18:03

2 Answers 2


v is used outside the ampscript block to print the output of the variable. you cannot use inside the ampscript block. Instead, define a variable and call that variable in the CreateSalesforceObjectfunction. Very first parameter of this function is the object name if it's the custom object then you should use the API name of the object else the code will throw an error

var @id
set @id = CreateSalesforceObject("NPS_Survey__c", 3, "RecordType", "012w0000000V749AAC" , "Account_Name__c",@ContactName, "NPS_Survey_Score__c","1") 
  • Abhishek's answer is good, but I'm not sure you need the object name in {{NPS_Survey__c:Account_Name__c}} Account_Name__c should be enough:)
    – Doug
    Commented Jun 21, 2017 at 17:29
  • yes it should. I have updated the answer. If that worked please accept my answer.
    – Abhishek
    Commented Jun 22, 2017 at 0:40

The final AMPscript was:

var @id 
set @id = CreateSalesforceObject("NPS_Survey__c", 3, "RecordTypeId", "012w0000000V749AAC", "NPS_Survey__c:Account_Name__c", @ContactName, "NPS_Survey_Score__c", "1")     

You must log in to answer this question.

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