LIST field on incident to display list of available fields on incident?

jlaps
Kilo Sage

Assume you had a P1P2 notification to be sent out for major incidents. Right now we have a MIM tab on incident that MIM agents fill out with data, and this gets populated into the SYSTEM STATUS page using HTML widget.

 

We are being asked to make this configurable. For example, if there was a LIST field on incident, where the available items in that list were the fields available on the incident (is there a way to do this??), and then a notification were to read this list of fields to populate a table (name of field - value of field).

 

The issue is that management keeps changing the format desired of what these emails look like, but its a pain to update the HTML coding on the widget to accommodate the different spacing issues this causes; it takes too long to change/test/implement. They want something dynamic that can show different things on a per incident basis, which is what got me thinking of a "list of fields" in a list field (or whatever might work). I do not see how to use a list field in this way, and cannot think of a better solution. Any ideas?

 

1 REPLY 1

Bert_c1
Kilo Patron

Hi jlaps,

 

Seems odd to do that, however the following script logic work for a custom field defined on the incident table of type List, length 4000.

 

var incFields = [];
var gr = new GlideRecord('sys_dictionary');
gr.addEncodedQuery('GOTOname=incident^internal_type!=collection^ORinternal_type=NULL');
gr.query();
gs.info('Found ' + gr.getRowCount() + ' records');
while (gr.next()) {
	incFields.push(gr.element.toString());
}
gs.info('Incident fields: ' + incFields);

// now lets load those in an incident custom field
var inc = new GlideRecord('incident');
inc.addQuery('number', 'INC0009009');
inc.query();
if (inc.next()) {
	gs.info('Updating ' + inc.number);
	inc.u_incident_fields = incFields.toString();
	inc.update();
}

You can modify the above to use in a Business Rule, and in a 'Fix script'. Note, the above does not include the fields form the parent task table.