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

Harish KM
Kilo Patron
Kilo Patron

Hi what is your requirement? You would need after BR here  because sysid will be generated only after insert

var abc = new GlideRecord("incident");
abc.initialize();
abc.short_description = "test";
var sysID = abc.insert();

Regards
Harish

Aman Kumar S
Kilo Patron

what is abc?

If it is giving blank value, it means abc.number is empty.

How will you get the number if the record is not created yet.

Best Regards
Aman Kumar

well abc is gliderecord of incident table. Full script has been shared above

suvro
Mega Sage

You have to write after Business rule 

 


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

current.update();