Skip to main content

Requested item id

  • February 15, 2024
  • 6 replies
  • 49 views

Forum|alt.badge.img+7

Inside a workflow, I have trigger: “Requested item added is”, and I am checking it. Later on, I need the ID of that Requested item that has been just added. How can I get it? I can only get the ticket, the Service Request ID.

The ideal will be when a new Requested item is added, I want the id.

6 replies

Daniel Söderlund
Top Contributor ⭐
Forum|alt.badge.img+14

You need to use the API endpoint https://api.freshservice.com/v2/#view_req_items_of_sr

 

 


Daniel Söderlund
Top Contributor ⭐
Forum|alt.badge.img+14

Inside a workflow, I have trigger: “Requested item added is”, and I am checking it. Later on, I need the ID of that Requested item that has been just added. How can I get it? I can only get the ticket, the Service Request ID.

The ideal will be when a new Requested item is added, I want the id.

Remember this will only work if a agent adds a item and not when requester place a request. 


Forum|alt.badge.img+7
  • Author
  • Skilled Expert
  • February 19, 2024

@Daniel Söderlund Well, I want to get the ID of the last Requested item added to a Request. Now I can get all the data in JSON, but I need the ID of the last one added item. It seems I need to iterate over array, but for now freshservice doesnt support such things. And I was curious If I can get it somehow. Or If i can use in workflow like $.requested_items[1].id, where 1 is the ID I need but I dont know the index I need there is no arr.length-1 for example...


Daniel Söderlund
Top Contributor ⭐
Forum|alt.badge.img+14

@Daniel Söderlund Well, I want to get the ID of the last Requested item added to a Request. Now I can get all the data in JSON, but I need the ID of the last one added item. It seems I need to iterate over array, but for now freshservice doesnt support such things. And I was curious If I can get it somehow. Or If i can use in workflow like $.requested_items[1].id, where 1 is the ID I need but I dont know the index I need there is no arr.length-1 for example...

 

 $.requested_items[-1:].id gives you the last one 


Forum|alt.badge.img+7
  • Author
  • Skilled Expert
  • February 19, 2024

@Daniel Söderlund The thing I needed! Thank you very much! :)


Daniel Söderlund
Top Contributor ⭐
Forum|alt.badge.img+14

@Daniel Söderlund The thing I needed! Thank you very much! :)

Remember to subscribe, like and comment… ops wrong platform but you get it ;) 

Mark the thread as solved :)