How to create a dependency between Caller and Channel in the incident form?

Alt30
Tera Contributor

Hello, I hope someone can help with the client script.

I am trying to test this in my PDI before working on the customers' dev instance but so far, all options I tried fail to create the auto population of the filed I am after.

In the incident form, I need the field Channel to be auto-populated with one of the dropdown options (say 'Email' as in PDI) if for example 'Abraham Lincoln' is selected in the Caller field. Is it possible and if yes, what script would work to achieve this? Thanks in advance for any useful suggestions!

 

1 ACCEPTED SOLUTION

swathisarang98
Giga Sage
Giga Sage

Hi @Alt30 ,

 

Contact type or channel is set based on how the end user raised the incident still if you want to make the changes or link between caller and channel you can create on change client script on Caller field and set the channel value,

swathisarang98_0-1717077198719.png

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }

  var caller = g_form.getReference('caller_id', currentUser1);

}
function currentUser1(caller){
	if(caller.name == 'Jerrod Bennett'){
		g_form.setValue('contact_type','email');
	}
}

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Alt30 

 

Greetings!!

 

Not sure what is your use case but channel should be not be populated based on user, it must populated how a user raising an incident. 

 

if you still want, you can use the data lookup and create your own lookup and use but again , a system has 100s of user how you will populate the data , also do u want to fix channel for few users or for all.

 

I request you , please see these points before you develop this. 

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

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

Alt30
Tera Contributor

Thanks, Atul, for quick response. I must clarify, that those options I use in PDI just to try to replicate the real thing. In the actual ask from the client, is to have a specific dependency: If 'Event Management' selected in Caller, Channel field should be populated with 'Event'.

Hi @Alt30 

 

Thanks for clarification. So you want to use specific caller and want to set the Channel. I think @swathisarang98  provided the script for same and you can use that. 

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

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

swathisarang98
Giga Sage
Giga Sage

Hi @Alt30 ,

 

Contact type or channel is set based on how the end user raised the incident still if you want to make the changes or link between caller and channel you can create on change client script on Caller field and set the channel value,

swathisarang98_0-1717077198719.png

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }

  var caller = g_form.getReference('caller_id', currentUser1);

}
function currentUser1(caller){
	if(caller.name == 'Jerrod Bennett'){
		g_form.setValue('contact_type','email');
	}
}

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang