How to send approval based on field updation in catalog item

Nani18
Tera Contributor

Hello Experts,

 

I have created a catalog item. In the catalog item i have created 8 fields

1. Computer CI (referenced to cmdb_ci_computer table)

2.Name (String)

3.Install status ( Choice)

4.Assignment group (Reference)

5.Workshift (Choice)

6.Business Domains (referenced to business_unit table)

7.Application Service (referenced to application table)

8.Where it is used (referenced to cmn_location table)

 

Once user select Computer CI then all 7 fields will autopopulate.

 

Now my requirement is  

1 . If user is updated only Name and Install status we want to send an approval to selected computer CI ==> owned by person.

2.If user is updated only Business Domains and Application Service then We want to send an approval to Selected Computer CI ==> Application Service==> Assignment group.

 

How to achieve this by using workflow...? 

 

And my one more question is how to know that user how many fields updated or modified in catalog item. 

 

Best Regards,

Nani

8 REPLIES 8

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Nani18 

For this, you need to write script 

As to compare the old value and new value and on basis of that create a approval activity.

*************************************************************************************************************
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]

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

Thank you @Dr Atul G- LNG 

 

What was that script ...? Could you please share me the script that will helpful for me. I am first time seeing this type of  requirement.

 

Best Regards, 

Nani

Hi @Nani18 

 

I dont have full set up but try like thsi

 

LearnNGrowAtul_0-1704289248413.png

 

 

I use one catalog item and try to compare.

*************************************************************************************************************
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]

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Nani18 

you can advanced script in the user approval activity and set the approver user or group

In the advanced script you can get to know the variable values and use IF condition

Something like this and you can enhance for your requirement

Handle it with multiple IF, ELSE statements

// Set the variable 'answer' to a comma-separated list of user ids and/or group ids or an array of user/group ids to add as approvers.
//
// For example:
//       answer = [];
//       answer.push('id1');
//       answer.push('id2');

answer = [];
if(current.variables.nameVariable && current.variables.install_status_variable)
	answer.push(current.variables.computer_ci_variable.owned_by.toString());
else if(current.variables.business_domainVariable && current.variables.application_serviceVariable)
	answer.push(current.variables.computer_ci_variable.appServiceField.assignment_group.toString());

AnkurBawiskar_0-1704290169003.png

 

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