After creation of incident populate incident number on custom field

Mark Wood
Tera Contributor

Hello Experts,

I have created one script include to create an incident after the creation of that incident I want to populate the incident number in one custom field named incident which refers to the incident table (custom field created on custom table let's say xyz custom table). How can I populate the incident number on that field after the creation of that incident?

Thank You.

   createIncident: function() {

        var gr = new GlideRecord('incident');
        gr.initialize();
        gr.caller_id = "1d98e3721b8df114eb2977f58d4bcb07";
        gr.assignment_group = 'e86beb761b8df114eb2977f58d4bcbdd';
        gr.category = "hardware";
        gr.impact = '3';
        gr.urgency = '3';
        gr.insert();
		

    },
1 REPLY 1

swathisarang98
Giga Sage
Giga Sage

Hi @Mark Wood ,

 

You can create an after insert Business Rule for incident table  and in the script you can add current.(your custom field name ) = current.number; it will update your custom field with incident number 

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

Thank You 

Swathi