Put the same category,subcategory and CI the task to the change request (parent)

williams2
Tera Expert

Hello, how can I assign the same category, subcategory and Configuration item from the Task catalog to a change request (parent) generated from a task (related list)?

williams2_1-1735945918083.png

 




williams2_0-1735945727466.png

 

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@williams2 

you can use before insert BR on change_request table

Condition: current.parent != ''

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	current.category = current.parent.category;
	current.cmdb_ci = current.parent.cmdb_ci;

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Runjay Patel
Giga Sage

Hi @williams2 ,

 

You can write before insert BR on change request table and use below script.

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	current.category = current.parent.category;
current.sub_category = current.parent.sub_category;
	current.cmdb_ci = current.parent.cmdb_ci;

})(current, previous);

 

RunjayPatel_0-1735975975028.png

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

View solution in original post

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @williams2 

 

I checked the task table and couldn't find the category and subcategory fields. Are you referring to catalog categories instead?

AGLearnNGrow_0-1735982613340.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

AndersBGS
Tera Patron
Tera Patron

Hi @williams2 ,

 

 as others already have stated, I would also recommend a business rule.

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/