Client Script

abdullahsardar9
Tera Contributor

Hi,

I want to update the caller's field ('email') of the incident through the client script only.

 

I appreciate your help.

3 REPLIES 3

Gaurav Shirsat
Mega Sage

Hello @abdullahsardar9 

Can You explain your Complete Use case here, so that I can help you,

because Caller is Reference Field on Incident Form. it refers to Data from sys_user Table

 

Thanks and Regards

Gaurav Shirsat

Hello @abdullahsardar9 

Try this sample code,

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
 
    var user = g_form.getReference('name', userDetails);
    
    function userDetails(user) {
alert(user.email);
        g_form.setValue('email', user.email);
    }
}

 

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Why would you like to update the callers field through a client script? Sounds a bit weird. Can you explain your case? And also WHEN this should happen. For example on load of a form could become a horrible user experience. So should this we onchange of a certain action perhaps?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn