Skip to main content

Hi All

Has anyone been able to find a way of listing all of the assets that a user has assigned to them, and report that back into a ticket.

 

Not sure if what you’re after, but there is an app (Quick View Requester Assets) in the market place that adds the requesters assets list on the right hand panel for quick view.

 

 

 


Thanks for responding, what I am trying to do is have a list of the assets assigned to a user in the CMDB placed in the incident or request, so when HR notify us of a leaver, we know what equipment is coming back to us.


Hey Mikey,

Are your HR team using a Service Item to notify you of an leaver? In my business we have HR complete a service item which includes a lookup field to all users.

We then use a filtered API call to retrieve the assets assigned to the user and then parsing the results so that it can be presented it in the ticket as a public note. 

This is my workflow:

This is the filtered API call I use:

 


@TagMan that looks amazing. Would love to understand a bit more how each of those workflow blocks works. I haven’t done much/any work with APIs so don’t really fully understand how you’ve structured each of those.

I notice in the Aciton block, there is an option for ‘Trigger Webhook’ also, but I can see you’ve used a Web Request…?


@martin.j I can’t take all the credit for this workflow, I was inspired by this post The Freshservice Ninja Challenge - Call for entries! | Freshworks Community. Below is a summary of what each of the blocks are doing:

  1. Event = Service Request is raised
    1. Check that the ticket is a SR
  2. Condition: Ticket Fields.Requested items includes your specified service item
  3. Web Request: API to retrieve asset details based on the user selected in the service item
  4. Condition: Using the API status code from the previous Web Request check that API has triggered correctly
    1. If it doesn’t trigger I add a private note for the agent to review and escalate if required
  5. JSON Parser: Parse the API header from the Web Request
  6. Condition: Check that the X-Search-Results-Count is not 0
    1. If the number is 0 then add a public note to advise the user does not have an asset assigned
  7. JSON Parser: Parse the response body from the Web Request
  8. Action: Add public note with users assigned assets

The reason I use an API via Web Request over an Action is because with a Web Request you get the option to Parse the data and then add conditions based on those results. The API via an Action block is fine when using PUSH and PUT type events but doesn’t offer the same visibility of success that the Web Request offers, I preference Web Request so that I can use the API Header to determine the success of the API.


@TagMan awesome, thankyou!


@TagMan I finally got around to doing this and it works great! The only thing i’m stuck on currently which wondering how you went about it, is formatting the response/not.

Currently the output lists all the asset names, and then all the asset tags, so for example:

Were you ever able to format yours more like:

Headset: HDS0001

Laptop: LAP0001

Security Card: SEC0001?

 

Marty


Hi @martin.j,

 

You can make for instance a bullet list with the asset names and tags, by using both object arrays from the Parser node. In this case I add the liquid filter code in a private note via the Action node:

 

{% assign name_array = {{P1.root.assets.assets_object.name}} %}

{% assign name_array = name_array | remove: ':' | remove: ']' | remove: '"' -%}

{% assign name_array = name_array | split: ',' %}

 

{% assign tags_array = {{P1.root.assets.assets_object.asset_tag}} %}

{% assign tags_array = tags_array | remove: 'e' | remove: ']' | remove: '"' -%}

{% assign tags_array = tags_array | split: ',' %}

 

{% for a in name_array %}

  • {{ a }} : {{ tags_arrayaforloop.index0] }}

{% endfor %}

 

The result in the private note will look like this:

 

 

Kind regards,

 

Rutger Bockholts

Freshworks

 


@Rutger Bockholts amazing! Thanks so much. That worked a treat


Reply