logo

NJP

Set Support Group From discovery schedule to CMDB CI field.

Import · Apr 24, 2024 · article

QUESTION : DID YOU READ ALL MY DISCOVERY ARTICLES ? But, Do it later....

I rescently has to populate 270,000 CIs Support Group / Assignment Groups from discovery... All our existing Discovery schedules were based on Device types like Windows discovery Schedule, Linux Discovery Schedule, CISCO Discovery schedule etc... Hence discovery schedule are created based on device type as there are no other discovery sources which updates CMDB.

png-transparent-sad-angry-man-face-annoyed-mad-emotion-expression-thumbnail.png

Its hard in my current environment to establish a communication with diffrent team and requesting to update the support group/assignment group. There were no logical critera do define bussiness rule / flows to determine support group for each device.

Are you facing similar issue or you wanted to populate certain field from Discovery Schedule to CMDB CI record ? Yes i have a working solution for you here...

Solution :

I decied to create a Custom field on Discovery schedule table named as 'DEEMS Support Group' this filed will consist of support group which is responsible for the IPs/Subnets Which are there in this discovery schedule that runs weekly. (dedicated discovery schedule for each team)

Lets say a support group called 'Automation team' > This team own 5 VMs , 20Wins servers , 6 Linux servers. I have create a discovery schedule for Automation Team as "DEEMS-Automation_Team Devices"" which has IPs and Subnets of all VMs, Win Server, Linux server in 1 schedule owned by them.

So, I would update the custom field with the value of their team name as > "DEEMS -Automation_Team Devices" , so when the discovery run and discovers new CIs or Updates existing CI the value of custom field will be copied to CMDB CI field ''Support Group'' OR ''Assignment Group''. Hence you will be having / setting Support group / Assignment group for all CIs discovered via Servicenow Discovery.

So lets see how did i do it ?

main-qimg-e860e50351d89bdfc08cbdcad0977124-lq.jpg

Step 1 :

First, Navigate to script include > search for *Discovery Schedule. Ull end up with below script include as shown in image.

Here you need to add a new variable as i have added for 'u_deem_support_group' (this is the custom field is which i wanted to copy it to the CI record.)

this.support_group = gr.getValue('u_deem_support_group'); //Replace 'u_deem_support_group' with your field value (in my case its a reference field)

SohailKhilji_0-1713963793183.png

Step 2 :

Now , You have obtained and stored the valued of the customfield in to a varaible called this.support_group in discovery schedule script include.

Navigate to > Sensor > Shazzam.

This is the script which will update the customfiled value in to the CMDB CI record.

Move to line > 103 (may change in future) , under which you need to call a function . in my case i created a function name called this.updateSupportGroup(); , Hence youcan include include the function call here at line > 105 (may change in future).

SohailKhilji_1-1713944731549.png

Step 3:

On the same script create function called updateSupportGroup();, So Move to line 699 (May change in Future) and create a new function which actually copies the value of a field from discovery schedule record to discovered CI record.

updateSupportGroup: function() {
if (!this.schedule.support_group) // here support group indicates the value which you have set in step 1 , for the variable this.schedule.support_group
return;
this.ciData.getData()['support_group'] = this.schedule.support_group;  // here support_group indicates the cmdb_ci table field
},

(Read the comments on the above script)

SohailKhilji_0-1713944731543.png

Step 4:

Save the record and run the discovery Schedule, Once the schedule is completed Check the CI which is updated / created you would see the support group/assignment group getting updated from discovery.

Also Read :

Set Discovery Schedule name to CMDB Record (via Discovery)

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0820001

Feel free to comment below the errors / issues / quries that you face and ill be happy to help !

If you find the article to be useful or effective for your knowledge Kindly Consider Marking the article HELPFUL and BOOKMARK if for your future use...

< Previous Post Next Post >

<<< Top Articles >>>

SohailKhilji_1-1713966056790.jpeg

MF Sohail Khilji | Servicenow Developer / Consultant.

Connect On LinkedIn >https://www.linkedin.com/in/mf-sohail-khilji/

Discovery #ITOM #Servicenow

View original source

https://www.servicenow.com/community/itom-articles/set-support-group-from-discovery-schedule-to-cmdb-ci-field/ta-p/2907928