cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Uploading attachments to servicenow

ppotto
Deputy Chef II
Deputy Chef II

Hi,

I'm trying to build a recipe that triggers on a new/updated JIRA issue and creates a Servicenow ticket, including attachments and comments. The current challenge is getting the recipe to upload to the servicenow incident. I used the recipe at: https://app.workato.com/recipes/555682-new-updated-jira-issue-will-create-update-servicenow-incident...

And after my tweaks and tests, I'm stuck on the step "Upload the attachment via HTTP". I tried other ways directly using pills and failed uploading to sys_attachments and sys_attachment_doc, so it seems that the HTTP upload might be the only way to go. The example recipe does not provide clues as to what pills or text is required to make the upload work. On the invetigation path, I was able to use the ServiceNow API explorer POST method found at https://<instancename>[.]service-now.com/now/nav/ui/classic/params/target/%24restapi.do . That API endpoint cannot be used in the recipe since the input includes a manually uploaded file. I have a feeling that I might be missing something simple. 

Can someone point out the data pills or text I might need to make the example work or an easier way that the HTTP upload?

Cursor_and_New_Updated_Jira_Issue_will_create_update_ServiceNow_Incident_with_attachments__Real_-_Time____Workato.png

Thanks!

1 ACCEPTED SOLUTION

ppotto
Deputy Chef II
Deputy Chef II

With the help of Workato, this is resolved. The fix included url encoding the filename. If the filename was not url encoded, those files that included spaces and/or special characters might not be handled gracefully in the interaction between Workato and the SNOW instance where I was uploading the file. It seems that SNOW was not consistently handling the spaces or special characters in the file name from Workato and ending up in a weird state that also put the workato job in a weird state. After adding the url encoding, the job went from 3 hours down to seconds and everything worked. 

View solution in original post

6 REPLIES 6

ppotto
Deputy Chef II
Deputy Chef II

There 'might' be an easier way, using "Upload attachment in ServiceNow", but I can't get that to work either.

Cursor_and_Copy_of____J--_SN__new_update_issue_-__new_incident___Workato.pngI tried various combinations of tables, file name, and file contents, all of which are returned at some point in my recipe, but nothing seems to work for me. I tried to find more information in the connector description, but there is no detail about how to use the upload action. 

snow-connectors-list.png

โ€ƒCan someone update the recipe linked in my OP or update the instructions on how to update "service now" uploads?

โ€ƒ

โ€ƒ

mppowe
Executive Chef I
Executive Chef I

I've used the "Upload attachment in ServiceNow" action for the Incidents table.  The Sys Id needs to be the right unique id of the Incident record, the filename I use is a csv (eg myErrors.csv), and the filecontents is the CSV contents.  In my Use Case I'm creating an incident and want to attach a CSV with supporting data, so the Sys Id gets returned to me from the "Create" action, and the CSV info I've made separately and just pass in.

Hopefully that helps?

 

 

ppotto
Deputy Chef II
Deputy Chef II

Thanks! I think I'm doing what you're describing, but let me clarify - I'm using the "Upload attachment in ServiceNow" to trigger on a JIRA new/update with the following info: SysID: sysID of the incident where I want to attach the file, Filename: file name pulled from the for each step in the original recipe linked in my OP.  

upload-j-to-s-for-each.pngand file contents are "Attachment content" from the download attachment step in my OP above.

I feel like I'm missing something simple since I'm using the exact recipe as above with the only changes the replacement of the upload via HTTP with the "Upload attachment in ServiceNow" and a bunch of log messages all over the place to try to figure out what's going on or not going on.

Any other guidance is appreciated.โ€ƒ

mppowe
Executive Chef I
Executive Chef I

It's hard to say without knowing what those values hold.  What error are you getting, exactly?

Perhaps you can try saving the file name and contents locally or emailing it to yourself as an attachment to make sure that there's no issue in the file contents.  You can also verify that the sys_id is right by trying to open it in ServiceNow.  I suspect the issue is in one of those 2 places