0

I want to create NOTE and tag it to existing lead in sales cloud. I have created a cloud page and using ampscript to acheive this. But somehow it is not working.

SET @noteCreate = CreateSalesforceObject('ContentDocumentLink', 3, 'title', 'Coming from cloud page', 'Description', 'This is the first note created from Cloud', 'LinkedEntityId', @leadCreate)

Please help!!

2
  • “Something is not working” is a quite vague description of your problem. Please be more precise. Also, do include more code than just this single line - as the real problem might be elsewhere – Lukas Lunow Feb 7 '20 at 8:50
  • LukasLunow, apart from this one line, there is another CreateSalesforceObject() call to create a lead and ID of that lead is stored in @leadcreate. but lead creation is working fine. Now i have remove that code and hardcoding the leadid in the above call. So, this is only code in my cloud page. – R Suri Feb 7 '20 at 8:55
0

CreateSFObject and the other cross cloud methods are nasty to debug blindly. Suggestion, wrap it in a try / catch block and put it on a cloudpage to get an error message, these usually help:

using your unchanged code:

<script type="javascript" runat="server">
Platform.Load("Core","1");
try {

</script>
%%[
 SET @noteCreate = CreateSalesforceObject('ContentDocumentLink', 3, 'title', 'Coming from cloud page', 'Description', 'This is the first note created from Cloud', 'LinkedEntityId', @leadCreate)

]%%
<script type="javascript" runat="server">
    Write("success");
} catch (err) {
    Write(Stringify(err));

}
</script>

typical errors for createSFOBject are listed below - the error message should give you a good indication where to begin.

a) have you included all required fields ? The docs say that "ShareType" is one of them, and you are missing it. Docs: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocumentlink.htm

b) Is the number of fields matching with the number of key value pairs you define (in your case, that looks fine)

c) general: do you have the permission as the Marketing Cloud API User? Try to perform the operation via the Sales Cloud UI to verify

d) wrong value formatting (dates, decimals...) - basically, go field by field.

e) duplicate rules (e.g. for leads and contacts)

Hope this helps

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.