The CreatorCon Call for Content is officially open! Get started here.

How can we do this

Abdul
Tera Contributor

i have a reference field in my catalog item which gets the data from cmn_department table.

Whenever a user selects certain department the location field should automatically be populated.  Also this has to be auto populated only when project type is renewal, which is a dropdown field 

How can we do this effieciently.

For eg if the user selects -> 1234 North Atlantic as department then the location field should be populated as Atlantic. 

Would client script work or we have to do with glide ajax?

 

Thanks 

2 REPLIES 2

GlideFather
Tera Patron

Hi @Abdul,

 

the behaviour that you described will need two scripts:

  • to reflect the change in the Department field
    • onChange client script for native UI (backend),
    • onChange catalog client script for Portal or ESC,
      • if you want both UIs then both scripts are needed
    • function in a script include
      • can be re-used for both CS and CCS if used properly

You can get inspiration from this: GlideAjax Example Cheat Sheet (UPDATED)

 

Let me know how does it go

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Ankur Bawiskar
Tera Patron
Tera Patron

@Abdul 

you can use onChange client script + getReference callback or GlideAjax for this

what did you start with and where are you stuck?

GlideAjax Example Cheat Sheet (UPDATED) 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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