Unable to find where the OOB CMDB notification event is triggered

Asha Gajjala
Kilo Contributor

Hi All,
We are looking to search the place where the below highlighted events are used to trigger the notification, but we haven't found any. We searched in all the script includes/business rules/ scheduled jobs/script actions etc. but no luck

Event Names: cmdbdatamanager.evaluation.failed & cmdbdatamanager.tasks.created

Any inputs are highly appreciated. 

11 REPLIES 11

Tony Wong
Kilo Guru

TLDR; I believe these events and the underlying logic (e.g. to generate the list of recipients) are held in native code that we don't have access to.

 

Once your certification policy is defined and scheduled, a corresponding CMDB Policy Scheduled Job record is created in [cmdb_policy_scheduled_job] with a script similar to this:

 

sn_cmdb_data_manager.CMDBDataManagerScopedScriptableApis.executePolicy(<sys_id of your policy>);

 

Unfortunately sn_cmdb_data_manager.CMDBDataManagerScopedScriptableApis does not appear to be available to us i.e. it is not Script Include that we can browse.

rlatorre
Kilo Sage

We opened a Case with ServiceNow and received this response:

 

Issue: You would like to know how the CMDB Data Management Task Failure notification is triggered and how the recipients are determined.

Analysis: After investigating the issue, I was able to find the following code in the Trigger Subflow for CMDB DM Task business rule. This business rule runs anytime a CMDBTASK state changes to work in progress:

function handleFailure(closeNotes, runAsUser) { current.setValue('state', 4); // Closed Incomplete current.setValue('close_notes', closeNotes); current.update();// send notification var grUserRoles = new GlideRecord("sys_user_has_role"); grUserRoles.addQuery("role", "b156309e53722010af64ddeeff7b1227"); // data_manager_admin role grUserRoles.query(); var userList = []; if (runAsUser) { userList.push(runAsUser);} while (grUserRoles.next()) { userList.push(grUserRoles.getValue('user')); } if (userList.length == 0) { gs.warn(gs.getMessage("The CMDB Data Manager policy: {0} does not have any users to send notification emails", current.policy_id)); return;}gs.eventQueue("cmdbdatamanager.task.failed", current, userList.toString(), current.policy_id);}


Based on the code, this function runs any time there is a "failure" when the business rule runs and we can see that the script queries the sys_user_has_role table for users with the data_manager_admin role. It then adds the users as a parameter to the cmdbdatamanager.task.failed, which then triggers the CMDB Data Management Task Failure notification.

Solution Proposed: The business rule "Trigger Subflow for CMDB DM Task" is responsible for triggering the CMDB Data Management Task Failure notification. It generates a list of users to send the notification to based on them having the data_manager_admin role. It runs anytime a CMDBTASK state changes to work in progress and will triggering the notification if there is a "failure" within the script in the business rule.

Do you have any more questions or concerns regarding this incident?

I'm hoping that this will be useful for you. For now, I am placing this incident in Solution Proposed state while you review this information.

If this answers your needs, please click the "Accept Solution" button for this incident. Please feel free to ask any additional questions you may have, and if needed, you can click the "Reject Solution" button above to set it as a Work in Progress and I will be happy to assist you further.


If you need more assistance after the incident is closed, you can reference this case number and open a new one.

Thank you,
Technical Support Engineer | ServiceNow