Has anyone had any luck/experience with the Salesforce connector and successfully inserting new rows to the Attachment API? I have a simple workflow where I take a sample text file into the Blob Input input tool, convert the blob to base64 (per Salesforce API), then append an exisitng parentId and Name (along with renaming the Blob input to 'Body' and shove that into a Salesforce output tool pointing at the Attachment table.
The result is a target record generated, but the response from the Salesforce output tool is "0 records processed and 0 failed across 1 batch".
I've played around with some other combinations of adding other non-required fields (CreatedDate, Description etc) with no changes. If I add something that is not part of the table the Salesforce output tool properly errors out.
Any ideas?
Thanks!
Solved! Go to Solution.
At a high level I don't see any glaring errors in what you're trying to do. (I don't have SFDC credentials currently to test with.) Sounds like you got it working with Workbench. Have you tried using Fiddler to compare the HTTP requests between Workbench and what you're trying with Alteryx?
Thanks for checking it out! I have tried repeating the oAuth SF process with Postman but I am having limited success. I am not sure how retrieve some of the fields that the oAuth Docs are describing in the documentation linked above.
I wonder-- could it be that using the Header name 'X-SFDC-Session' is an expected field for the SOAP API, but the REST API expects a different header name for that value?
That information should be in the documentation somewhere. As I recall, a deprecated version of the Salesforce Input tool used an SFDC REST API. Check out:
C:\Program Files\Alteryx\bin\RuntimeData\Macros\Supporting_Macros\SalesforceInput.yxmc
Looks like the REST API request needs a header called "Authorization" which contains "Bearer [sessionId]" where sessionId comes from the SOAP auth response.
Thanks @NeilR! I tested that now and am getting a field error as opposed to an authentication one which is progress!
Here's what I did:
1. Formula tool after the Session Id is appended to the main flow constructing the JSON intended for REST POST'ing
2. Field Name -> Authorization
3. Formula: "Bearer " + [X-SFDC-Session]
Then swapped out the X-SFDC-Session Header with the newly created Authorization one and it authenticated!
Now on to solving the Blob naming issue
Edit/Epilogue: I was able to successfully POST the Attachment to salesforce using the connector! Now I just need to test a 25MB+ file
Edit 2: I tested a 66MB Zip File and returned this error:
[{"message":"; nested exception is: \n\tcommon.exception.ApiException: Maximum size of request reached.
Maximum size of request is 52428800 bytes.","errorCode":"JSON_PARSER_ERROR"}]
So takeaway: it is possible to POST attachments using a SOAP authentication-produced session id and a JSON of
ParentId Name Body
Buuuut Salesforce REST API seems to cap the file size to 52,428,800 Bytes / 50MB which is not what their API says they do
At this point, we'll likely tweak the workflow and write the base64 encoded file to Amazon S3 or some other CDN and write the link back to Salesforce
User | Count |
---|---|
56 | |
27 | |
25 | |
23 | |
21 |