- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2023 10:06 PM
When a HR case is in State = Awaiting Acceptance, we have 5 scenarios like below:
- Accepted
- Rejected
- Timed out by 5 business day workflow (case State = Closed Complete)
- Case in 'Awaiting Acceptance' is rejected then accepted once back in 'Awaiting Acceptance' again
- Case in 'Awaiting Acceptance' is rejected more than once (e.g. Ready > Work In Progress > Awaiting Acceptance > Work In Progress > Awaiting Acceptance > Work In Progress > Awaiting Acceptance > Closed Complete)
Post an event to the Metric Instance so that these events can be reported, item should include HRC# so that data can be tied back to HR Service etc.
Not fixed on Metric Instance, if there's a better way to solve for this please let me know, Performance Analytics?- I just want to report on what happens to Awaiting Acceptance cases to understand user behaviour better.
Fin Nguyen
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 07:29 AM
Hi @Fin Nguyen
After HR Case moved to Awaiting Acceptance, the workflow will be triggered through the business rule.
Name: Trigger Awaiting Acceptance Workflow
URL: https://<instance_name>/sys_script.do?sys_id=3e5330019f22120047a2d126c42e70fc
So, you need to define somewhere to capture this type of information (5 scenarios you mentioned) for reporting.
The Metric Definition is a good way to capture needed data for reporting unless you'd like to customize the table.
And, you need to script in the Metric Definition to achieve it.
Sample below.
if (current.getValue('state') === '20') {
if (current.opened_by == gs.getUserID() || current.opened_for == gs.getUserID()) {
createMetric(definition, current);
}
}
function createMetric(definition, record) {
var gr = new GlideRecord('metric_instance');
gr.table = record.getRecordClassName();
gr.id = record.sys_id;
gr.definition = definition.sys_id;
gr.field = definition.field;
gr.field_value = record.state;
gr.value = 'Accepted';
gr.insert();
}
The sample does not cover all the cases, let base on it and apply for other scenarios.
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 07:29 AM
Hi @Fin Nguyen
After HR Case moved to Awaiting Acceptance, the workflow will be triggered through the business rule.
Name: Trigger Awaiting Acceptance Workflow
URL: https://<instance_name>/sys_script.do?sys_id=3e5330019f22120047a2d126c42e70fc
So, you need to define somewhere to capture this type of information (5 scenarios you mentioned) for reporting.
The Metric Definition is a good way to capture needed data for reporting unless you'd like to customize the table.
And, you need to script in the Metric Definition to achieve it.
Sample below.
if (current.getValue('state') === '20') {
if (current.opened_by == gs.getUserID() || current.opened_for == gs.getUserID()) {
createMetric(definition, current);
}
}
function createMetric(definition, record) {
var gr = new GlideRecord('metric_instance');
gr.table = record.getRecordClassName();
gr.id = record.sys_id;
gr.definition = definition.sys_id;
gr.field = definition.field;
gr.field_value = record.state;
gr.value = 'Accepted';
gr.insert();
}
The sample does not cover all the cases, let base on it and apply for other scenarios.
Let me know if it works for you.
Cheers,
Tai Vu