Create a custom button and a custom field - clicking on the button should populate the custom field

KarangulaB
Tera Contributor

I have a requirement to Create a custom button and a custom field.

clicking on the button should populate the custom field with the count of incidents assigned to the given assignment group

Help me with this.

1 REPLY 1

J Siva
Tera Sage

Hi @KarangulaB 
Try the below solution.

1. Custom string field:

JSiva_0-1748233438812.png

2. Custom UI action:

JSiva_1-1748233477774.png

JSiva_2-1748233516038.png

var records = new GlideRecord('incident');
records.addQuery('assignment_group', current.assignment_group);
records.addQuery('state', '!=', 7); // 7 is the state for 'Closed'
records.query();
current.u_incident_count = records.getRowCount();
current.update();
action.setRedirectURL(current);

 

Modify the script as required.

Regards,
Siva