Expand my Community achievements bar.

Salesforce Rest Endpoint Post

Avatar

Level 3

Hello,

I'm trying to create an AEM Form which POSTs directly to a Salesforce endpoint (action "Submit to REST endpoint). But I get an exception from guideContainer.af.internalsubmit.jsp which says:

com.adobe.aemds.guide.utils.XMLUtils Invalid Xpath Syntax: 00N0Q000000tYMk
javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: 00N0Q000000tYMk could not be formatted as a number.

'00N0Q000000tYMk' is the name of the input, which I want to post and which is necessary for salesforce. 

How can I prevent this exception? Any suggestions?

Thanks for your help!

Andrea

7 Replies

Avatar

Level 9

Are you able to submit from the form data model test editor?

Avatar

Level 3

Sorry, but I don't really know what you mean with "form data model test editor". Can you explain?

 

Additional info:

My AEM version: Adobe Experience Manager 6.5.7.0 with AEM Forms 6.5.7.0 Add-on for OSX

Avatar

Level 9

The recommended approach is to create DataSource using swagge file. Then use this data source to create form data model

The following video should give you a good understanding. Although the video is created using AEM Forms Cloud Service, the steps are the same for AEM Forms on premise version

https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/forms/integrate-with-...

Avatar

Level 3

Thanks for you answer. But do I really need such an effort to connect to SF? I only have a tiny form for a newsletter subscription with less inputs. I don't need any authorization at SF. I only have to send the OID as a hidden field to SF. 

If I create a simple HTML file with a form and post it to SF, it works. But if I manually create a form at AEM forms, I get the error from my message above. It seems that AEM Forms has problems with the SF-like input names like 00N0Q000000tYMk. But why?

Avatar

Level 9

so your SFDC instance does not need any authorization? What objects are you trying to create in SFDC?

what is the submot action of the form that you have created in AEM forms?

Avatar

Level 3

I have no knowledge about SF but I also implemented a similar Post to SF in the past for another customer (via the AEM Backend, not AEM Forms). He provided which data they needed (which parameter names, which fields are required, the oid etc) and the endpoint and I did there also a simple post and it worked. 

And now I try it for another customer but via AEM Forms. I try to send simple values like first name, last name or email address. But some field names have no "speaking name" they have typical SF names like "00N0Q000000tYMk", which AEM Forms isn't able to handle.

The submit action I selected is "Submit to REST endpoint" with the checkbox "Enable POST request" ticked.

 

Avatar

Level 9

if you are creating lead object in salesforce on form submission, you are better off creating the integration using the form data model method that I sent you earlier. its not that hard, the lead object is already defined for you in the swagger file. All you need to do is the create connected app in salesforce and use its credentials in the AEM Forms cloud configuration.

As to your approach- it should also work AEM Forms simply forwards the request to the POST url specified in the submit options