How to Auto Populate Employee number in catalog item

Shweta Kasbe1
Tera Contributor

How to Auto Populate Employee number in catalog item

1 ACCEPTED SOLUTION

Prasad Dhumal
Mega Sage
Mega Sage

Hello Shweta,

configure OnChange catalog Client Script and use below logic:

function onChange(control, oldValue, newValue, isLoading) {


var id = g_form.getReference('<fieldName>');//replace 'fieldName' with the name of your reference field.

  g_form.setValue('emp_number', id.emp_number);

}

View solution in original post

3 REPLIES 3

Prasad Dhumal
Mega Sage
Mega Sage

Hello Shweta,

configure OnChange catalog Client Script and use below logic:

function onChange(control, oldValue, newValue, isLoading) {


var id = g_form.getReference('<fieldName>');//replace 'fieldName' with the name of your reference field.

  g_form.setValue('emp_number', id.emp_number);

}

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you provide some more details to your question?

what variables are there and when should this happen? is it based on change of some other variable?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Not sure about your exact requirement since you didn't provide much details. Though below article might help you. Zero code involved.

2021-02-11 Catalog Data Lookup Definition on any table, eliminating Catalog Client Scripting

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn