how to query a table in client script in servicenow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 10:02 AM
Based on requested for how to populate the values such as (city, country code, employee number, gender, street, zip code) from the custom table (u_uc_divya) to the service catalog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 11:54 AM
"data" is the variable for the getReference (or the requested_for sys_id in other words)...this is passed to the function myData. So the function sets the values of those fields using the data from the sys_id it was passed. So the requested_for's city, country_code, employee_number, etc...
If your "requested_for" field is referencing a custom table, your field names from the table may be u_ctiy, u_country_code, etc...So data.u_ctiy or data.u_country_code.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 12:17 AM
If city/zip/etc is not stored in the sys_user table, you need to create a Client Callable Script Include which does the lookup and retrieve the result using GlideAjax.
The Requested For Field is a reference field on sys_user?
Can you show us the table name + field names for the custom table and the fields names you want to retrieve?