Populate the reference field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
There is a reference field that displays a filtered record using Script include and Reference qual in the field. It displays the matching record and the user has to click on the record to select it in the field. How can I make the record auto populate in the field without the user having to click and select it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
@Elvin_Salim , You’ll need client-side scripting to detect when there’s only one matching record and then set the value automatically.
When the form loads, the client script calls the Script Include.
If only one record matches, it returns the sys_id and display_value.
Client script then auto-fills the reference field for the user.
Hope it helps!
Shashank Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
there's no point in auto populating as there could be multiple records satisfying that filter.
which one you will auto-populate?
This is not a good user UI experience.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar ,
Thanks for your time and the response. I solved it by moving the logic from script include to business rule.
BR,
Elvin