Question

Using the API to add any asset from inventory to a new ticket

  • 23 October 2021
  • 1 reply
  • 240 views

Badge

Posting this here since it’s about Freshservice and not Freshdesk specifically, but there isn’t an API specific category.

I’m using a Service Request to create a form for technicians, primarily student workers, to fill out when they check on printers in labs and public spaces to report on the amount of paper present and if there are any printer issues to report.  If the amount of paper present is below a certain threshold and/or there is a problem with the printer, an Incident ticket is created using webhooks to the API; if it is both items, there are two tickets created as they are different issues.

This logic works just fine.

However, what I would like to is attach the printer reported to the ticket via the API.  The SR form gets me the name of the printer, which is in the {{ticket.ri_74_cf_which_printer}} variable.  However, to add an asset to a ticket that is being created, I need to use the display_id for the printer.  I know this is available through the URL for the printer, but I’m stuck on how to go about adding it programmatically with the API to the ticket.

Any thoughts or recommendations?


1 reply

Userlevel 4
Badge +6

Hi @Luyar123 ,

If you have access to custom objects and if cf_which_printer is a dropdown field, you can create a matrix that stores the dropdown field value and the corresponding display ID of the asset.

Using a workflow when this type of request is created, you can glide the custom object to get the display ID and then use the display ID to associate the asset to the ticket using API.

Reply