Inbound Actions - Update Incident (BP) creates new Incident

SNowUser11
Kilo Guru

Hello Experts,

I am facing an issue. Although it is working for the OOB inbound actions 'create incident','create incident (forwarded) and Update Incident (BP). I am getting perfectly results as per these actions. Now My scenario is 

- I want to update an incident when an email comes as forwarded for any incident emails like example

FW:Incident INC0001234 has been opened on your behalf 

what could be the simple way to achieve this i tried creating another 'Update Incident (BP) with action as Forward but it seems created a new incident running this. Not getting why? Any suggestion please do not want to go with scripting unless it is not achievable in inbound actions

Thanks

1 ACCEPTED SOLUTION

SNowUser11
Kilo Guru

Just in case what at last I did to work if that helps anyone

-Created new Update Inbound Action (as Forward), Stop processing -checked.order=10

-script which helped

--------------------------

gs.include('validators');
var str = email.subject.toString();
var regex = new SNC.Regex('/INC\\d{7}/im');
var incnum = regex.match(str);
if(incnum!= null)
{
var target = new GlideRecord('incident');
target.addQuery('number',incnum);
target.query();
if(target.next() && target.getValue('state') != IncidentState.CLOSED)

target.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;
target.update();
sys_email.instance = target.sys_id;
sys_email.target_table = target.getTableName();
sys_email.update();

}
}

-------------------------------------

 

View solution in original post

21 REPLIES 21

It will be affected.

There is a reason why it is separated between reply and forward.

If reply, it will update existing based on the watermark it will fetch the record and updates it.

If you are saying its forward then it means it is not reply anymore so it tries to create an incident and not update any existing record. 

If you don't to add few to your reply email prefix, then in your inbound action you have to handle the update part by fetching the right record using gliderecord in the Actions tab and fetch the record either based on subject or any other data and then do the update through script without using current object.

Mark the comment as a correct answer and helpful if it solves the problem.

Hi Asif,

So how do I Identify that an forward email is for existing Incident record. Does that mean that need to check from Email Body any incident number exist or from Subject line if any existing Incident number exists?

Thanks

yes, based on subject or body, fetch the number and then look for the record.

If this has answered your question, kindly mark the comment as a correct answer so that the question is moved to the solved list.

Hi Asif,

Just another point notices though all is working fine. Incident is getting updated via inbound action(NOT the OOB one) but in email logs it shows Did not create or updated Incident . In reality it did updated and thats what was needed. 

Wondering why logs showed up like that? Any idea

Thanks