How to assign a tag to a record using flow

Wildo Grande
Tera Contributor

Hi

 

I have been trying to resolve a simple need in servicenow ITSM, which is to assign automatically a tag to some tasks records (incidents, problems, changes) that match certain conditions.

 

I'm aware there is a feature for auto-tagging, but in my case I need the record to keep the tag when it loses those conditions, and the reason why is because some work groups need to report and track every record that was managed by them at some point of the ticket's lifescycle.

 

For example:

 

A new Incident is created and assigned to the Service desk group, then this record is updated changing the assigned_to and state fields. Since there is an active record for Service Desk group, which was assigned and is in progress, the ticket must be marked with the tag "ServiceDesk". Later the record could by escalated, managed and resolved by a 2nd level support. 

 

Finally, Service Desk team will need to include in their reports all the tickets in which they were involved at some point. Also, as the Service Desk is the responsible for the communication over all incidents, they need to check the quality of the resolution notes, completeness of the records and the overall quality of the information provided to the client.

 

(BTW, I put it all the story here just in case that you can recommend the best way to solve this use case)

 

I found tagging the easiest way to achieve it, despite the follow and watchlist are also available. Because I need some automation here, I created a simple flow (driven by my common sense, not a real knowledge in flow design), and tried to update the incident record, assigning the string "ServiceDesk" in the tags field, that matches with the name of an existing global tag, but, despite the flow is triggered (match the condition), no tag is being assigned.

 

So, I've tried adding a previous step to retrieve the label record "ServiceDesk", then assigned it to the incident record, but I got the same result: No tag in the incident that triggered the flow.

 

So, doing some research I was able to understand a little the tag implementation, so my last try was generating an label_entry record pointing the incident sys_id to the Table key field and selecting the right tag in the label field. At this point, I think to be in the right path, but other fields need to be populated as well, so I stopped and look how difficult this configuration is becoming, and I wonder if there is an easier/correct way to succeed on this.

 find_real_file.png

12 REPLIES 12

Michael Fry1
Kilo Patron

Seems like this would be best accomplished by creating your own Action, passing in tag name, and sysID of record. Then your gliderecord would be on the label_entry table. Then find your record and do an insert.

Hi @Michael Fry 

I would like to ask your help to get a better understanding on your suggestion

  • By creating my own action, you meant that I need to declare all the steps in flow, because there isn't a out of the box function to assign tags? Or it's about to create some script that I could call as a flow action?
  • Talking about passing the tag and sys_id, I assume is the same what I already tried (image attached), including the insert opertation in the label_entry table. Am I misunderstanding your instructions?

Thank you

Was looking in my instance and I don't see Create Label Entry record action. Is this already a custom action?

If yes, try changing your table to Incident and the field to Tags. Maybe that's the problem?

No, it's not a custom action. It's a core one: Create Record, pointing to insert the record in the table label_entry.

The reason why I implemented this twisted solution rather than impact directly the incident table and tags fields is explained at the beginning of the post. Here's the cutted version: 

... and tried to update the incident record, assigning the string "ServiceDesk" in the tags field, that matches with the name of an existing global tag, but, despite the flow is triggered (match the condition), no tag is being assigned.

So, I've tried adding a previous step to retrieve the label record "ServiceDesk", then assigned it to the incident record, but I got the same result: No tag in the incident that triggered the flow.