Show only required fields in GlideModal

Mahendra RC
Mega Sage

Hi All,

I am using the below code to show the User data in Popup window, but I am getting all the fields that are present in "User" table list view (i.e. User ID, Name, Email, Active, Created and Updated fields). But I want only 3 fields to be shown in Popup Window (i.e. User ID, Name and Email fields).

Is there some issue with the below line :

gdw.setPreference('sysparm_fields', 'user_name,name,email');

function getUsersPopUp(usersId, popUpTitle) {
			try {
				var title = 'Show User Data';
				var query = 'emailIN' + usersId;
				var gdw = new GlideModal('show_list');
				gdw.setTitle(title);
				gdw.setSize(750);
				gdw.setPreference('table', 'sys_user_list');
				gdw.setPreference('sysparm_query', query);
				gdw.setPreference('sysparm_fields', 'user_name,name,email');
				gdw.setPreference('title', 'A New Title');
				gdw.render();
			} catch (e) {
				jslog('error showing Not Sent Users');
				jslog(e);
			}
		}

Can anyone please let me know how can I show only the required fields in GlideModal, instead of showing all the fields present in User table list. I don't want to configure list layout for User table for this.

Thanks,

Mahendra

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Mahendra,

When you open the dialog window and have table in it it uses default list view. you can specify your own view by giving this line.

gdw.setPreference('sysparm_view','<viewName>');

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Mahendra,

Any update on this?
Can you mark my answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Mahendra,

Any update on this?
Can you mark my answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

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

ikusghiuweghaku
Tera Contributor

Hi Ankur

 

Is it possible to show two fields in GlideModal?

 

Thanks