How to auto populate a record producer field based on reference field selection.

jmcm
Tera Contributor

Hi,

I want to auto populate the field DESC with the description of the incident selected in field INC.

Once the incident has been selected, the description of the incident should auto fill.

How can this be achieved with a catalog client script to do a glide ajax to a script include?

All help is appreciated, thanks in advance!

find_real_file.png

11 REPLIES 11

Hi @jmcm ,

If I helped you to resolve your query with my answer. Then I would really appreciate if you can mark my answer correct and helpful. So that it can be moved to answered list and helpful for future readers.

Regards,
Ujjawal

Prasad Pagar
Mega Sage

Hi @jmcm 

This can be done using onchange client script. Please make sure you run script on change of incident field and update variable names correctly below.

Try below code

var selected_value = g_form.getReference('incident', myCallBack);

function myCallBack(selected_value) {
g_form.setValue('description',selected_value.description);
}

Thank you
Prasad

The SN Nerd
Giga Sage
Giga Sage
See my guide on this subject, which shows the best approach depending on your version https://community.servicenow.com/community?id=community_blog&sys_id=e89fe70d1b3bac10fc3233bc1d4bcbe6 If your on Quebec, you can (and probably should) use the no code approach

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

The SN Nerd
Giga Sage
Giga Sage

@jmcm I have replied to this on the sndev slack


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Ujjawal Vishnoi
Mega Sage

@jmcm 

Please mark my response correct and helpful. If I am able to help you with your query and it can be moved to answered list and helpful for future readers.