Rafael_Kaufmann1 | 2020-09-15 10:35:22 UTC | #1
Hello,
I try to use the OTB Salesforce integration. We built it up like described in the resource center. But if we test the integration we get the following Error Code:
{ "message": "The request could not be understood by the server due to malformed syntax.", "code": "bad.request", "status": 400, "messageParams": {}, "contextId": "c054e338-f6d2-4372-86df-448f761b1c97", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: [{\"message\":\"\\nAccount(AccountNumber, AccountSource, AnnualRevenue, BillingAddress, BillingCity\\n ^\\nERROR at Row:1:Column:87\\nNo such column 'AnnualRevenue' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '_c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.\",\"errorCode\":\"INVALIDFIELD\"}] [c054e338-f6d2-4372-86df-448f761b1c97]", "code": "BADREQUEST", "status": 400, "messageParams": {}, "details": [], "errors": [] } ] }
Do you know where did i went the wrong way??
Kind regards, Rafael Kaufmann
Jason_Mathison | 2020-09-15 12:25:53 UTC | #2
Could this be a field level permission issue?
https://stackoverflow.com/questions/19826129/salesforce-api-no-such-column-annualrevenue-on-entity-account
Rafael_Kaufmann1 | 2020-09-15 12:30:50 UTC | #3
ok, I copied the Data Action and changed it a little because I just need the ContactId (Get ContactId by phone number). But now i have the problem with the successTemplate. I changed it to the following, but it didn´t work { "translationMap": { "contact": "$.searchRecords" }, "successTemplate": "{\"contacts\": ${contact}}" }
How does the success Template have to look like if I just want to get the Contact ID as an output?
anon28885283 | 2020-09-16 02:36:35 UTC | #4
Is there a specific message saying what the error is on the successTemplate?
If you're building the Data Action off of the default "Get Contact By Phone Number" and all you need is the Contact ID then what you can do is remove the other fields from the Output Contract and keep the "Id". There is no need to change the default response configuration which is
{ "translationMap": { "contact": "$.searchRecords" }, "translationMapDefaults": {}, "successTemplate": "${contact}" }
If you're still getting errors, you may also export the action and upload it here as an attachment so we'll be able to check the entire configuration
Rafael_Kaufmann1 | 2020-09-16 10:10:26 UTC | #5
Thank you for your help. I don´t get an error. The variable id is just not filled with the AccountId but the action is able to find the Contact I look for.
{ "name": "get ContactID by phone number (Kopie) - Exported 2020-09-16 @ 12:08", "integrationType": "salesforce-datadip", "actionType": "custom", "config": { "request": { "requestUrlTemplate": "/services/data/v37.0/search/?q=$esc.url(\"FIND {$salesforce.escReserved(${input.PHONENUMBER}))} IN PHONE FIELDS RETURNING Contact(AccountId)\")", "requestType": "GET", "headers": { "UserAgent": "PureCloudIntegrations/1.0" }, "requestTemplate": "${input.rawRequest}" }, "response": { "translationMap": { "contact": "$.searchRecords[*].['AccountId']" }, "translationMapDefaults": {}, "successTemplate": "{\n \"contact\": ${contact}\n}" } }, "contract": { "input": { "inputSchema": { "title": "Phone number request", "type": "object", "properties": { "PHONENUMBER": { "type": "string" } }, "additionalProperties": true } }, "output": { "successSchema": { "title": "Contact", "type": "object", "properties": { "id": { "type": "string" } }, "additionalProperties": true } } }, "secure": false }
anon28885283 | 2020-09-18 02:16:42 UTC | #6
If an Output is not filled but there is no error that usually means that the successtemplate did not properly match the output contract. The forum does some weird formatting over code/JSON (so it's recommended to upload the file itself) but I tried recreating what I think you currently have and there are a couple of things:
- The translationmap results in an array of AccountIds - even if there's only one result.
- The successtemplate assigns that value to a "contact" output field which does not exist. Right now, your only Output field is "id" and it's expecting a string not an array.
- You mentioned earlier you wanted to get the ContactID which is diferent from the AccountID. If so, you need the SF field "Id" not "AccountId"
Anyway, based on your current config I've modified it so it will assign the first AccountId to your output. Get-Contact-By-Phone-Number---ST-S2D-2020091895912.custom.json|attachment (1.5 KB)
This might not meet the requirements of your action especially if you actually want to have the array instead of just the first result but you can use it as a reference.
system | 2020-10-19 02:16:46 UTC | #7
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 8821