The CreatorCon Call for Content is officially open! Get started here.

Hi. I need to put Correlation ID of the Incident as TCSCE {incident number} while incident gets created. Please check script. It is not working

EKTA2
Tera Expert

I have written below script in Before Insert BR to Populate Correlation ID as TCSCE:{Number}. But number is not getting populated. screenshot below. 

 

var abc = new GlideRecord("incident");
abc.initialize();
abc.correlation_id = "TCSCE:" + "{" + abc.number  + "}";
abc.insert();

 

In output, All I am getting is as attached image below. Number is missing. 

 

 

I guess it is happening, because Number value is not available for Before insert BR. But then how can I do this requirement?

1 ACCEPTED SOLUTION

suvro
Mega Sage

You have to write after Business rule 

 


current.correlation_id = "TCSCE:" + "{" + current.number  + "}";
current.setWorkflow(false);

current.update();

View solution in original post

6 REPLIES 6

Actually Incident is getting created via Integration. Correlation ID is already getting populated via Integration. I just have to change it to TCSCE{Number}.

Mahesh Baraskar
Mega Guru

Hi Ekta,

 

Before insert BR will not work as the number is not yet saved in the new record in database.  You can write the same code with After Insert.

 

Please let me know if it works or not.