Flow - Checking if incident exists

Damian Martinez
Mega Sage

Hello, I hope everyone is ok and safe, Happy New Year, all the best for 2022.
I have a flow with logic to create or update an existing incident.
The logic is simple:
1. look up the incident record
2. if the incident exists (I have some conditions there) then, update it.
3. If incident does not exist, create a new one.
The issue I have is that it creates a new one every time, because I can't check if the incident record exists.
I tried the solution from this post: https://community.servicenow.com/community?id=community_question&sys_id=9a2359a7db28bfc014d6fb24399619bf
However I don't have the option for If count is 0, so I can't add that condition.
Does somebody know what I'm missing?
is count not available for look up records incidents?
Thanks in advance!

10 REPLIES 10

palanikumar
Mega Sage

Hi Damian,

Lookup Record Action throw exception if no record returned. If your requirement is to update if already exist and create new record if not exist then you can handle Record creation in Error handler section.

Refer the screen below:

find_real_file.png

Thank you,
Palani

Damian Martinez
Mega Sage

Hello Guys,
thanks for your feedback, for some reason, I am having issues with this flow now, I activated and it says it successfully activated but the status is draft and it is not giving any errors.

I've never seen this before so I opened a case with servicenow support.
At the moment the flow is not working because it is not activated.

Once I have some news I'll get back to you.

Damian Martinez
Mega Sage

Hello Everyone, I continue working on this flow today but still not working.
I added the action look up records.
then I added the if statement if count is 0.
However when testing the flow it is creating a new incident even thought an incident with the same short description is already open.
What I want is that if an incident with short description x already exists and the status is new or in progress, the email should append to the existing incident, but if the status is resolved or closed, create a new incident.

Thanks

Share the screenshot of the workflow. Also make sure you are passing correct short description in the filter condition.

Thank you,

Palani

Thank you,
Palani

OlaN
Giga Sage
Giga Sage

Hi,

I've just read through this thread, and based on the discussion I'm interpreted it that you want to add the incoming email to an existing Incident if the Subject lines match the short description of an open incident, otherwise it should create a new Incident.

That could be done, but what should happen if more than one in-progress-incident exists with the exact same short description?

I've made a simple example for you to try, which doesn't handle the above exception of multiple records matching. I've used "Look up record" not "Look up records" as the assumption you can only have one record with matching short description.

find_real_file.png