Browse Guides

Handling Attachments/Files in Runbooks
Reading mode
Copy Link
Link Copied!
Print
Feedback
This guide has multiple versions available:
<style>p { margin: 0; }span.fr-emoticon.fr-emoticon-img { background-repeat: no-repeat !important; font-size: inherit; height: 1em; width: 1em; min-height: 20px; min-width: 20px; display: inline-block; margin: -0.1em 0.1em 0.1em; line-height: 1; vertical-align: middle; } span.fr-emoticon { font-weight: normal; font-family: "Apple Color Emoji", "Segoe UI Emoji", "NotoColorEmoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols"; display: inline; line-height: 0; } blockquote { border-left: solid 2px #5e35b1; color: #5e35b1; margin-left:0; padding-left:5px;}blockquote blockquote{ border-color: #00bcd4; color: #00bcd4;}blockquote blockquote blockquote{ border-color: #43a047; color: #43a047;} table.grid{ border-collapse: collapse;} table.grid td, table.grid th { border: 1px solid #ddd;} .fr-fic.fr-dib{ display: block; margin: 5px auto;}.fr-fic.fr-dib.fr-fir{ text-align: right; margin: 5px 0 5px auto;}.fr-fic.fr-dib.fr-fil{ text-align: left; margin: 5px auto 5px 0;}.fr-fic.fr-dii{ float: none; margin: 5px auto;}.fr-fic.fr-dii.fr-fil{ float: left; margin: 5px auto;}.fr-fic.fr-dii.fr-fir{ float: right; margin: 5px auto;}img.fr-dib.fr-fir { margin-right: 0; text-align: right;}img.fr-dib.fr-fil { margin-left: 0; text-align: left;}img.fr-dib { margin: 5px auto; display: block; float: none;}img.fr-bordered { box-sizing: content-box; border: solid 5px #CCC;}img.fr-shadow { box-shadow: 10px 10px 5px 0px #cccccc;}img.fr-rounded { border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;}</style><style> p { margin: 0; } span.fr-emoticon.fr-emoticon-img { background-repeat: no-repeat !important; font-size: inherit; height: 1em; width: 1em; min-height: 20px; min-width: 20px; display: inline-block; margin: -0.1em 0.1em 0.1em; line-height: 1; vertical-align: middle; } span.fr-emoticon { font-weight: normal; font-family: "Apple Color Emoji", "Segoe UI Emoji", "NotoColorEmoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols"; display: inline; line-height: 0; } blockquote { border-left: solid 2px #5e35b1; color: #5e35b1; margin-left: 0; padding-left: 5px; } blockquote blockquote { border-color: #00bcd4; color: #00bcd4; } blockquote blockquote blockquote { border-color: #43a047; color: #43a047; } table.grid { border-collapse: collapse; } table.grid td, table.grid th { border: 1px solid #ddd; } .fr-fic.fr-dib { display: block; margin: 5px auto; } .fr-fic.fr-dib.fr-fir { text-align: right; margin: 5px 0 5px auto; } .fr-fic.fr-dib.fr-fil { text-align: left; margin: 5px auto 5px 0; } .fr-fic.fr-dii { float: none; margin: 5px auto; } .fr-fic.fr-dii.fr-fil { float: left; margin: 5px auto; } .fr-fic.fr-dii.fr-fir { float: right; margin: 5px auto; } img.fr-dib.fr-fir { margin-right: 0; text-align: right; } img.fr-dib.fr-fil { margin-left: 0; text-align: left; } img.fr-dib { margin: 5px auto; display: block; float: none; } img.fr-bordered { box-sizing: content-box; border: solid 5px #CCC; } img.fr-shadow { box-shadow: 10px 10px 5px 0px #cccccc; } img.fr-rounded { border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; } </style><style> p { margin: 0; } span.fr-emoticon.fr-emoticon-img { background-repeat: no-repeat !important; font-size: inherit; height: 1em; width: 1em; min-height: 20px; min-width: 20px; display: inline-block; margin: -0.1em 0.1em 0.1em; line-height: 1; vertical-align: middle; } span.fr-emoticon { font-weight: normal; font-family: "Apple Color Emoji", "Segoe UI Emoji", "NotoColorEmoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols"; display: inline; line-height: 0; } blockquote { border-left: solid 2px #5e35b1; color: #5e35b1; margin-left: 0; padding-left: 5px; } blockquote blockquote { border-color: #00bcd4; color: #00bcd4; } blockquote blockquote blockquote { border-color: #43a047; color: #43a047; } table.grid { border-collapse: collapse; } table.grid td, table.grid th { border: 1px solid #ddd; } .fr-fic.fr-dib { display: block; margin: 5px auto; } .fr-fic.fr-dib.fr-fir { text-align: right; margin: 5px 0 5px auto; } .fr-fic.fr-dib.fr-fil { text-align: left; margin: 5px auto 5px 0; } .fr-fic.fr-dii { float: none; margin: 5px auto; } .fr-fic.fr-dii.fr-fil { float: left; margin: 5px auto; } .fr-fic.fr-dii.fr-fir { float: right; margin: 5px auto; } img.fr-dib.fr-fir { margin-right: 0; text-align: right; } img.fr-dib.fr-fil { margin-left: 0; text-align: left; } img.fr-dib { margin: 5px auto; display: block; float: none; } img.fr-bordered { box-sizing: content-box; border: solid 5px #CCC; } img.fr-shadow { box-shadow: 10px 10px 5px 0px #cccccc; } img.fr-rounded { border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; } </style><style> p { margin: 0; } span.fr-emoticon.fr-emoticon-img { background-repeat: no-repeat !important; font-size: inherit; height: 1em; width: 1em; min-height: 20px; min-width: 20px; display: inline-block; margin: -0.1em 0.1em 0.1em; line-height: 1; vertical-align: middle; } span.fr-emoticon { font-weight: normal; font-family: "Apple Color Emoji", "Segoe UI Emoji", "NotoColorEmoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols"; display: inline; line-height: 0; } blockquote { border-left: solid 2px #5e35b1; color: #5e35b1; margin-left: 0; padding-left: 5px; } blockquote blockquote { border-color: #00bcd4; color: #00bcd4; } blockquote blockquote blockquote { border-color: #43a047; color: #43a047; } table.grid { border-collapse: collapse; } table.grid td, table.grid th { border: 1px solid #ddd; } .fr-fic.fr-dib { display: block; margin: 5px auto; } .fr-fic.fr-dib.fr-fir { text-align: right; margin: 5px 0 5px auto; } .fr-fic.fr-dib.fr-fil { text-align: left; margin: 5px auto 5px 0; } .fr-fic.fr-dii { float: none; margin: 5px auto; } .fr-fic.fr-dii.fr-fil { float: left; margin: 5px auto; } .fr-fic.fr-dii.fr-fir { float: right; margin: 5px auto; } img.fr-dib.fr-fir { margin-right: 0; text-align: right; } img.fr-dib.fr-fil { margin-left: 0; text-align: left; } img.fr-dib { margin: 5px auto; display: block; float: none; } img.fr-bordered { box-sizing: content-box; border: solid 5px #CCC; } img.fr-shadow { box-shadow: 10px 10px 5px 0px #cccccc; } img.fr-rounded { border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; } </style><p><strong>In this guide we will cover:</strong></p><p><strong><style data-pasted="true">.pf0{}</style></strong></p><p><strong>- Attachment Endpoint</strong></p><p><strong>- Sending Files in your Halo Instance to another Halo Instance or to Another Tool as Form Data</strong></p><p><strong>- Sending Files in your Halo instance to another Halo instance or to another tool as a Downloadable Link</strong></p><p><strong>- Obtaining Files from another Tool</strong></p><p><strong>- Obtaining Attachment Details (Get Attachment Metadata API Action)</strong></p><p><strong>- Worked Example</strong></p><p><br></p><p><br></p><p>This guide covers how the Halo API can be utilised to send/receive files, using <a data-fr-linked="true" href="https://usehalo.com/haloitsm/guides/1630" data-pasted="true" target="_blank" rel="noopener noreferrer">integration runbooks</a>. Useful when sending attachments between two Halo instances, or when sending/receiving attachments from Halo to another tool. These features allow you to upload attachments from Halo to another service that accepts files in multipart/form-data format or as a temporary public link, and to download attachments from a file response or temporary public link.</p><p><br></p><p>Halo runbooks can download file responses of up to 28MB. Halo runbooks can upload files of up to the attachment size limit.</p><p><br></p><p>Throughout this guide we will use the terms &#39;file&#39; and &#39;attachment&#39; interchangeably.&nbsp;</p><p><span style="font-size: 12pt;"><br></span></p><p><strong><span style="font-size: 12pt;"><em>Prerequisites:</em></span></strong></p><ul><li data-pasted="true" style="font-weight: bold; font-style: italic;"><em><strong>Attachment Storage Location = S3&nbsp;</strong></em><ul style="font-weight: initial; font-style: initial;"><li style="font-weight: bold; font-style: italic;"><strong><em>This can be set under Configuration &gt; Advanced Settings &gt; &quot;Attachment Storage Location&quot;.</em></strong></li></ul></li></ul><p><br></p><p><br></p><p><strong><span style="font-size: 14pt;">Attachment Endpoint</span></strong></p><p>In order to send an attachment to a Halo instance, or obtain an attachment from a Halo instance a request will need to be sent to the following endpoint:</p><ul><li style="font-style: italic;"><em>api/attachment</em></li></ul><p><br></p><p><strong><em>Note: As this uploads the file to the Halo API this is restricted to upload of 28MB, unlike client-side uploads which can upload straight to the tenants own S3 bucket.</em></strong></p><p><br></p><p><strong data-pasted="true"><span style="font-size: 14pt;">Sending Files in your Halo Instance to another Halo Instance or to Another Tool</span></strong></p><p><strong><span style="font-size: 12pt;">Obtain Halo attachment ID</span></strong></p><p>In order to send a file in your Halo instance to another service you will first need to obtain the ID of the file you are looking to send. This is required as you will later need to specify the ID of the file you are sending.&nbsp;</p><p><br></p><p><strong><em>Note: Every file stored in Halo will have a unique ID.&nbsp;</em></strong></p><p><br></p><p>This can be done by running a sql query on your database, or you can obtain this information from the API.&nbsp;</p><p><br></p><p>To obtain this information from the API you will need to do a GET request on the attachment endpoint in your instance and create a runbook/output variable to store the attachment ID in. Figure 1 shows the method used to obtain attachment data for a specified ticket in your instance.&nbsp;</p><p><br></p><p><em><strong>Note: The value of &#39;ticket_id&#39; can be replaced with a variable.&nbsp;</strong></em></p><p><strong><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjgyNTQ1OGRhLTc1NDUtNDJlYi1iYjE2LWE1NzczN2I4ZDgyMSJ9.pTKIQJZRu0056SMrRV0PUtqQ0u58z1o20GIQ-JOC6y8" class="fr-fic fr-fil fr-dib" width="1500" style="width: 1502px; height: 566.792px;" height="567"></strong></p><p><strong><span style="font-size: 10pt;">Fig 1. Get Attachment Data for a Specified Ticket</span></strong></p><p><strong><br></strong></p><p>Figure 2 shows the output variable that will store the attachment ID contained within the response to this request.&nbsp;</p><p><strong><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkOTU3ODllLWJlYTAtNDhjMi1iN2NjLTlhM2QxNWE5MWM1OSJ9.1osM3Wm3uYutv-xsB6ovXgjfs3aKqiCj-oWlEZsOvnA" class="fr-fic fr-fil fr-dib" width="1546" style="width: 1548px; height: 286.448px;" height="286"></strong></p><p><strong><span style="font-size: 10pt;">Fig 2. Output Variable to Store Attachment ID</span></strong></p><p><strong><br></strong></p><p>Keep in mind as multiple attachments can be stored against a single entity, these will be returned as an array. Therefore, you will need to specify which attachment you would like the variable to store. This is done using the [x] element, [0] will return the first attachment in the array.&nbsp;</p><p><br></p><p>Once you have created a runbook step to obtain the file ID you will need to create another step to send this file off.&nbsp;</p><p><br></p><p><strong><span style="font-size: 12pt;">Sending Files as Form Data</span></strong></p><p>Once you have obtained the ID of the file you are looking to send (and have stored this in a variable) you can send this file to another Halo instance or tool. This is done using a POST request with a &quot;form-data&quot; body type. If sending a file from one Halo instance to another, this is the recommended way to send the file over.&nbsp;</p><p><br></p><p>To do this create a new Runbook step with type &quot;Action&quot; and action type &quot;Execute an Integration Method&quot;, create a new method.&nbsp;</p><p><br></p><p>Within the body of the method choose the &quot;form-data&quot; body type. Here, you will need to specify the file part and any text parts to send over.</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxNDJhOTczLTdjYmUtNDcwZC1hMjVlLWMzMjFlNmNiNTkzZCJ9.uUdkaer8qQnfHal2LCh8f4dBUOm-ZUNHn-zSj2Su4ao" class="fr-fic fr-fil fr-dib" width="1550" style="width: 1552px; height: 629.736px;" height="630"></p><p><strong><span style="font-size: 10pt;">Fig 3. Method to send a File to another Halo Instance</span></strong></p><p><br></p><p><strong>File Part:</strong> This must be the ID of the file in your Halo instance that you want to send over. The attachment ID should be obtained in a previous step. Here, enter the variable the attachment ID is stored in. &nbsp;</p><p><strong>Text parts:</strong> These will be any properties you would like to be included in the request. This could be the name of the attachment, the ticket the attachment is added to in the other Halo instance (if sending to another Halo instance).&nbsp;</p><p><br></p><p><strong>Keys:</strong> Key names must match the specification of the receiving API. In the figure 3 example a request is being sent to another Halo instance, therefore, the key names reflect those available at Halo&#39;s attachment endpoint.</p><p><br></p><p>The attachment will be accessed as a stream from S3 and attached to the output request.</p><p><br></p><p>If this method is being used to send an attachment to another Halo instance files up to 28MB can be sent, or the &quot;Client Side Upload&quot; flow can be emulated to allow for larger uploads straight to the tenants S3 bucket.</p><p><br></p><p data-pasted="true"><strong><span style="font-size: 12pt;">Sending Files in your Halo instance to another Halo instance or to another tool as a Downloadable Link</span></strong></p><p><span style="font-size: 11pt;">This method of sending files is used when you would like to send a file you have in your Halo to another service, and this service expects attachments as a link to download.&nbsp;</span></p><p><br></p><p><strong><span style="font-size: 11pt;">Obtain a Downloadable Link for a File in your Halo instance (Get Attachment link API action)</span></strong></p><p data-pasted="true">Before a file can be sent, you will first need to obtain a downloadable link for this file from your instance.&nbsp;</p><p><br></p><p>In order to obtain a downloadable link for an attachment, you will need to obtain the ID of the attachment first. A prior runbook step will need to be created to do this. See the section &quot;Obtain Halo attachment ID&quot; for information on how to do this.&nbsp;</p><p><br></p><p>Now, create a Runbook step with the type &quot;Action&quot; and the action type &quot;Halo API Action&quot;. Then you can choose the action &quot;Get Attachment Link&quot;.</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImQxOGFlNjQwLTFiZTYtNDY0ZS1iZTM0LWY4MjdlNzZhZThlZSJ9.Ehy2Z37mh9k19BWD5t4qk3BqB_uvK6ilEIznQwQTCyc" class="fr-fic fr-fil fr-dib" width="1275" style="width: 1277px; height: 505.251px;" height="505"></p><p><strong><span style="font-size: 10pt;">Fig 4. Get Attachment Link API Action</span></strong></p><p><br></p><p><strong><em>Note: Fields here are case sensitive.&nbsp;</em></strong></p><p><br></p><p>Within the action you will need to specify the ID if the attachment (in your instance) that you would like to send to the other service.&nbsp;</p><p><br></p><p>Then add an output variable for the step to store the link that is returned. As shown in figure 5.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjBlOTU0YjY5LTFiN2MtNGZkMi1hMjEwLTUzNmY2NWZlNzRhNCJ9.HO-sHCVAnszaBTTTw6Er4_-DYJdjtNcLQiLgOdJKJ3E" class="fr-fic fr-fil fr-dib" width="1320" style="width: 1322px; height: 390.965px;" height="391"></p><p><strong><span style="font-size: 10pt;">Fig 5. Variable to store attachment link</span></strong></p><p><br></p><p>This variable will need to be used in later steps to send the link out.&nbsp;</p><p><br></p><p><strong><span style="font-size: 11pt;">Sending the File Link</span></strong></p><p>Once you have obtained a downloadable link for the file in your Halo instance, you will need to create another step within your runbook that sends this link to the endpoint of the chosen tool.&nbsp;</p><p><br></p><p>As the link for the file in Halo was obtained in the previous step the output variable created (&lt;&lt;File_Link&gt;&gt;) should be used in the body of the request to send the link.</p><p><br></p><p><strong><span style="font-size: 14pt;">Obtaining Files from another Tool</span></strong></p><p><strong><span style="font-size: 12pt;">Receiving (GET) Attachments&nbsp;</span></strong></p><p>When obtaining a file from outside your current Halo instance, you will need to create a step that executes a GET method within your runbook. The endpoint you are executing this method on will need to returns a file stream (such as a downloadable link).&nbsp;</p><p><br></p><p>Within this method you will need to check &quot;Response is a File&quot;, under the &quot;Advanced&quot; section.</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImFkYzgxYTYxLWQ0MzEtNDA2NS05Yjg5LWYwMDAxZDJmNmJkYyJ9.PpI3AKScSfw-tPN_en1XtgrbkzVneyEJo8qlPZ1mgDs" class="fr-fic fr-fil fr-dib" width="1628" style="width: 1630px; height: 588.217px;" height="588"></p><p><strong><span style="font-size: 10pt;">Fig 6. Method to obtain a File using a download URL</span></strong></p><p><br></p><p>When &quot;Response is a File&quot; is checked the file received will be uploaded directly to S3 as a temporary attachment. This temporary attachment will be given an ID and the ID will then be returned as the response of this method. This ID will then be used in later steps to send the attachment elsewhere.&nbsp;</p><p><br></p><p>The &quot;Content-Type&quot; header returned will be used to determine the name of the file created/downloaded. Data within this header will be used as the filename.&nbsp;</p><p><br></p><p>To save the attachment to an entity in your Halo instance (saving the attachment permanently), use the &quot;Update Attachment&quot; API action. This is covered in the next section.&nbsp;</p><p><br></p><p data-pasted="true"><strong><span style="font-size: 12pt;">Upload Files to Halo Entities (Update Attachment API action)</span></strong></p><p>Once you have obtained a file via the API, this will be stored temporarily. In order to store the file in Halo permanently you will need to use the &quot;Update Attachment&quot; API action. This action will move the file from the temporary storage location and store it against a chosen entity, such as a ticket or client.</p><p><br></p><p><strong><em>Note: You cannot write attachment data this way.</em></strong></p><p><br></p><p>To do this create a Runbook step with the type &quot;Action&quot; and the action type &quot;Halo API Action&quot;. Then you can choose the action &quot;Update Attachment&quot;.<img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjI4MTM0YjllLWM4NzktNDFmNS1hZWU4LTUwZjNjNWYyOWQyOCJ9.bxrCTKh1LcshkE070DJo041HJkjCJjrBIGf84QFvoEk" class="fr-fic fr-fil fr-dib" width="1330" style="width: 1332px; height: 631.714px;" height="632"></p><p><strong><span style="font-size: 10pt;">Fig 7. Update attachment API Action</span></strong></p><p><br></p><p>Then you will need to construct a JSON body to determine which attachment you would like to add to which entity. In the figure 8 example the attachment obtained in the previous step will be added to a ticket in my Halo instance.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjBhMzFkYWExLTUwY2YtNGMxZi1iYTZjLWVlOTIyOWFkNTIyMSJ9.4sd9Vomo9X6kaDVKe26Leq_gxlLrQc7Q9I1kxJ5aUYs" class="fr-fic fr-fil fr-dib" width="998" style="width: 1000px; height: 411.454px;" height="411"></p><p><strong><span style="font-size: 10pt;">Fig 8. Example body for Update Attachment API Action</span></strong></p><p><br></p><p><strong>id:</strong> Here add the ID of the attachment you would like to move. This is usually obtained using the method shown in the section &quot;Receiving (GET) attachments (in responses)&quot;.</p><p><strong>type:&nbsp;</strong>Here add the ID of the type of entity you would like to upload the attachment to. Use 0 for tickets and 1 for clients.</p><p><strong>unique_id:</strong> Here add the ID of the object you would like to upload the attachment to. If uploading to specific client, add the ID of the specific client here. Ticket IDs can either be added here or using &#39;ticket_id&#39;.</p><p><strong>ticket_id:</strong> Only used when uploading the file to a ticket. Add the ID of the ticket you would like to add the attachment to here. If using set &#39;unique_id&#39; to 0.&nbsp;</p><p><br></p><p>Now, when this step is executed, the file will be added/saved to your chosen entity.&nbsp;</p><p><br></p><p><strong><span style="font-size: 14pt;">Obtaining Attachment Details (Get Attachment Metadata API Action)</span></strong></p><p data-pasted="true">This action is used to obtain attachment metadata (such as names and file sizes) from files in your instance, in order to create a pre-signed upload url, emulating the Client side uploads flow in Runbooks.</p><p><br></p><p>To do this create a Runbook step with the type &quot;Action&quot; and the action type &quot;Halo API Action&quot;. Then you can choose the action &quot;Get Attachment Metadata&quot;.</p><p><br></p><p>Within the action you will need to specify the ID of the file (in Halo) you would like to get the data of. The response of the action will contain the attachment data.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ3YzBkYjYxLWY1MjItNDhiMS1iNWZiLTc1ZmMwZGEzYjkyNyJ9.keGf_U4s16uSI41ewM3EoNQZkGcFSJ9WSIkJ02YwqZo" class="fr-fic fr-fil fr-dib" width="1450" style="width: 1452px; height: 483.354px;" height="483"></p><p><strong><span style="font-size: 10pt;">Fig 9. Get Attachment Metadata API Action</span></strong></p><p><br></p><p><strong><em>Note: Blob data is not included.&nbsp;</em></strong></p><p><br></p><p><strong><span style="font-size: 14pt;">Worked Example</span></strong></p><p>In this example we will create a runbook that takes an attachment (file) on a given ticket and sends this to a chosen ticket in another Halo instance. The ticket the attachment is sent to will be determined by a custom field on the Halo ticket, useful when tickets have been migrated to another instance, using a custom field to store the associated ticket&#39;s ID.&nbsp;</p><p><br></p><p>First, create a runbook and add an event trigger to control when the runbook runs.</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjNjZTBjNjczLWVkZDYtNDQ4MS1hMWJhLTQxZDQwYjVjYzIxMCJ9.aT0_PbUnDu_vz4HV7PwmZX6T2z94HYuQxo7GLeBrtL4" class="fr-fic fr-fil fr-dib" width="1363" style="width: 1365px; height: 596.276px;" height="596"></p><p><strong><span style="font-size: 10pt;">Fig 10. Event to trigger the runbook</span></strong></p><p><br></p><p>In this example we have created an action called &quot;Send attachments&quot; for this purpose.&nbsp;</p><p><br></p><p>Now head to the &quot;Flow Chart&quot; tab and add a new step with type &quot;Action&quot; and Action Type &quot;Execute an Integration Method&quot;, then make a new method.&nbsp;</p><p><br></p><p>The new method will execute a GET request on our own instance.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjBkNTk1YjNkLTllYTctNDVkMi05ZTA1LTRmYTVhYTczZjU0MCJ9.ovefMT5-yuU_GY_Kft-m1YNzGFFKJtm8lEcoamC3dj8" class="fr-fic fr-fil fr-dib" width="1593" style="width: 1595px; height: 605.525px;" height="606"></p><p><strong><span style="font-size: 10pt;">Fig 11. Method to Get attachments from a ticket</span></strong></p><p><br></p><p>Query Params are added to specify which ticket attachments are being taken from. The variable &lt;&lt;ticket^id&gt;&gt; will pull in the id of the ticket that triggered the runbook, that is, the ticket that the action was used on.&nbsp;</p><p><br></p><p>Create an Output Variable to store the ID of the attachment returned.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA1YTM0Y2RmLTM0ODgtNGVkOC04NDAzLTIxYjE4ZTBhODBlMSJ9.wfgAeFBQXzVL1xj9MOLLgMUWmEd7CBRqNU2grdo7Uh0" class="fr-fic fr-fil fr-dib" width="1343" style="width: 1345px; height: 627.609px;" height="628"></p><p><span style="color: rgb(0, 0, 0);"><strong><span style="font-size: 10pt;">Fig 12. Output Variable to store attachment IDs</span></strong></span></p><p><br></p><p><span style="color: rgb(0, 0, 0);">The response will return an array of all the IDs of the attachments against the ticket, in this example we only want to send the first attachment returned so we use the [0] to extract the first attachment ID.&nbsp;</span></p><p><br></p><p>In the &quot;Integration&quot; field, you will need to select a custom integration that authenticates access to your own instance. For information on creating custom integrations checkout <a target="_blank" rel="noopener noreferrer" data-fr-linked="true" href="https://usehalo.com/haloitsm/guides/2660">Custom Integrations</a>.&nbsp;</p><p><br></p><p>Now save the method and the step.&nbsp;</p><p><br></p><p>Now create a step to send the files to the chosen instance. Create a new step of type Action with an Action Type &quot;Execute an Integration Method&quot;. Then create a new method.&nbsp;</p><p><br></p><p>The method will look as shown in figure 13.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjNhYWMzYTQ5LTI5OTYtNDdjZS05MGQ2LTlhOGRiMDI1YmZiZSJ9.1SYGzHY5aiFK0GMuOMCSU5X1diguTtTGfx6RB-8SsEw" class="fr-fic fr-fil fr-dib" width="1350" style="width: 1352px; height: 654.222px;" height="654"></p><p><strong><span style="font-size: 10pt;">Fig 13. Method to send Attachment to other Instance</span></strong></p><p><br></p><p>Here, the variable &lt;&lt;CFTickettosendattachmentto!&gt;&gt; is used to control the ticket ID that the file will be sent to in the other instance. This field is just a text custom field, containing the ID of the ticket to send the attachment to. The agent may enter this manually when carrying out the action, or this may already be populated. An &quot;!&quot; has been appended to this variable to remove &quot;&quot; marks around the ID.&nbsp;</p><p><br></p><p><strong><em>Note: Remember to configure authorisation to the instance you are sending the attachment to. Authorisation can be added on the runbook step, or using a <a href="https://usehalo.com/haloitsm/guides/2660" target="_blank" rel="noopener noreferrer">custom integration</a>.&nbsp;</em></strong></p><p><br></p><p>Now, when the action &quot;Send Attachments&quot; is used, the agent can choose which ticket to send the attachment to. Then the attachment on this ticket will be sent to the specified ticket in the other Halo instance.&nbsp;</p><p><img src="https://halo.haloservicedesk.com/api/attachment/image?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImEzMDFiMjllLTllNDYtNDEyMC05NGE4LTE5OTU1NWVjMWY0OSJ9.SEOFNagvMFdAJ6zLGNkBiftUTqiRN7bZ_mjYMWrmJsE" class="fr-fic fr-fil fr-dib" width="339" style="width: 341px; height: 211.223px;" height="211"></p><p><strong><span style="font-size: 10pt;">Fig 14. Action to trigger runbook</span></strong></p>
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.