Auto Populate a reference field

Nishant26
Tera Contributor

Hi All,

 

I have a requirement where I need to auto-populate Service Address field(reference field) from caller's location(dot walking) on the form.

 

Please let me know how to achieve this.

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Nishant26 

 

I tried with very simple case

 

I added a field on incident form , which is dot walk from caller.location. and it is getting populate. 

 

AGLearnNGrow_0-1709830081528.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]

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

how did you configure your field to dot walk caller.location?

I am on incident form

Go to form layout 

caller 

 

AGLearnNGrow_0-1709832082138.pngAGLearnNGrow_1-1709832098347.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]

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

Sumanth16
Kilo Patron

Hi @Nishant26 ,

 

Create on load script like below

 

function onLoad() {


    if (g_form.getValue('u_impacted_user') == '') {
        var impactuser = g_form.getReference("caller_id", loadImpactUser);//update your caller id field

        function loadImpactUser(impactuser) {


            g_form.setValue("location", impactuser.location.sys_id);//update you field name

        }
    }

}

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda