I want to display fields from the Alerts table in the Incidents table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 05:26 AM
hi everyone
I want to display the event_count of the em_alert table in the incident table.
I have the following current implementations.
1.Create an integer custom field in the incident table
2.Script Include Create
Search for alerts from incidents and get event_count
3.Business rule Create
Update incident custom field before querying
It is possible to display,but I have no idea how to make it more efficient.
I would be happy to learn of other ways to do this.
please remember me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 05:46 AM
Hi @nullpo1 ,
Hope you are doing well.
Nice approach but updating using query BR can cause slowness and performance issue if there are multiple users interacting with the forms and if incident count is huge.
Hope about using a on load client script with a client callable script include. You can update the incident record in the script include.
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 02:58 AM
Thanks for help @Harshal Aditya
I understand up to the point of checking "Client Callble" and making it available to the client.
I did not understand that after this is checked, the on-load client script is used. If you could give me some more details, that would be great.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 05:55 AM
Hi @nullpo1 ,
Hope you are doing great.
You can create Business rule and use below script for updating count :
var eventCount = 0;
var gr = new GlideAggregate('em_alert');
gr.addQuery('incident', current.sys_id); // Assuming you want to display the event_count for the current incident
gr.addAggregate('COUNT');
gr.query();
if (gr.next()) {
eventCount = gr.getAggregate('COUNT');
}
current.event_count = eventCount;
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 03:03 AM
Thanks for help @Riya Verma
Since event_count is a field in the alerts table, does that mean you are counting the number of alerts associated with the incident?
Please tell me what you mean by recounting the number instead of getting the information from the field