How to fetch reference/select fields values from widget
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 05:49 AM
Dear experts,
I have a widget, where there are string fields as well as Select fields (basically reference values in it). When I try to fetch values of a record submitted through this form, I am able to fetch the string values, but not able to fetch the reference or select values.
<div class="form-group col-md-6">
<lable>Site IT Manager </lable>
<select name="site_manager" class="form-control">
<option ng-value="MEP 1 "ng-repeat = "userName in data.owner">{{userName.name}} </option>
</select>
</div>
// with below code, we are getting options in fields on client side.
(function() {
data.owner = [];
var user = new GlideRecord('sys_user');
user.orderBy('number');
user.query();
while (user.next()) {
var userName = {};
userName.name = user.getValue('first_name') + " " +user.getValue('last_name');
data.owner.push(userName);
}
// here we are trying to fetch the given/selected value
if(input){
gs.addInfoMessage("name "+input.site_manager);
var acc = new GlideRecord('x_int46_flex_2_0_account_management');
acc.site_manager = input.site_manager;
acc.account_description = input.myTextareaModel;
acc.mep_cc = input.mep_code;
acc.account_owner=input.acc_owner;
acc.insert();
}
Values populating in reference/select fields.
Please check the info message returning undefined value.
Kindly guide.
Regards,
Ayushi Singhal
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 12:47 AM
Glad to know.
Please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader