1

We have a validation rule on creating contacts which forces the Account Name to be set. When creating the Contact using AMPScript how do I set the Account to be the value I want? (This can be a hard coded Account as we only use one).

I have tried setting the AccountId but this doesnt get past the validation rule.

CreateSalesforceObject("Contact",8,"FirstName",@firstName,"LastName",@lastName,"Email",@email,"Gender__c",@gender,"MobilePhone",@mobile,"Recieve_HTML_Emails__c",@emailTxtImage,"Receive_Text_Emails__c",@emailTxt,"Receive_SMS__c",@sms,"AccountId","TESTID")

Tried setting Account to TEST even though this is not a field on contact record.

CreateSalesforceObject("Contact",8,"FirstName",@firstName,"LastName",@lastName,"Email",@email,"Gender__c",@gender,"MobilePhone",@mobile,"Recieve_HTML_Emails__c",@emailTxtImage,"Receive_Text_Emails__c",@emailTxt,"Receive_SMS__c",@sms,"Account.Name","TEST") 

Here is the validation Rule

Account.Name <> "TEST"

I have also tried changing the Validation Rule to be on the AccountId but this doesnt work when saving the contact through Salesforce.

Any help appreciated. Cheers

1

School boy error, number of fields updated was 9 not 8, so the parameter in question was being missed. Changing it to 9 meant that using the AccountId worked.

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.