UI Page Pop Up called from UI Action in Cab Meeting Related List

iva25
Tera Contributor

There is one Requirement I am trying to build.

There is one button named as "Send meeting request to attendees copy" - this is a UI Action.

 

iva25_2-1750443631884.png

 


When you click on "Send meeting request to attendees copy" one pop up will be shown up that is a UI page named as "attendee_notifications_popup"

iva25_1-1750443586254.png



Requirement:
The Popup Should showcase the names of the attendees present the cab meeting Attendees related list.
- The user can be added to the attendee list from the glide list

- The user can be removed from the attendee list

- The glide list should be auto filled with the existing attendee

- The popup should show the email body which is going to be sent to the attendee

 

What I have done
- I am to get the list of the existing attendees

- I am able to get the sys ids of the existing attendees

 

Challenges I am facing
- How to pass the sys ids of the cab meeting from the UI action to the UI page or How I can get the sys ids of the cab meeting so that I can filter out dynamically the attendees for each meeting

- The glide list is not showing the existing attendees for which I am able to get the sys ids

 

 

UI Page Code:
HTML:

<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <g:evaluate>
        var cbgr = new GlideRecord('cab_attendee'); // Querying the 'cab_attendee' table
        cbgr.addEncodedQuery("cab_meeting=ddb4a4ef5ca712104f3496f8659cf639"); // Hardcoded for testing
        cbgr.query();

        // Create an array to hold attendee names
        var attendees = [];
        while(cbgr.next()){
        attendees.push(cbgr.attendee.getDisplayValue()); // Push attendee display names to array
        gs.info("Avi: Attendees List: " + cbgr.attendee.getDisplayValue());
        }

        // Convert the attendees array to a comma-separated string to pass to Jelly
        var attendeesString = attendees.join(',');

        // Pass the attendees string to the Jelly template
        attendeesString;
    </g:evaluate>

    <g:evaluate>
        var cbgr = new GlideRecord('cab_attendee'); // Querying the 'cab_attendee' table
        cbgr.addEncodedQuery("cab_meeting=ddb4a4ef5ca712104f3496f8659cf639"); // Hardcoded for testing
        cbgr.query();

        // Create an array to hold attendee names
        var attendeesid = [];
        while(cbgr.next()){
        attendeesid.push(cbgr.attendee); // Push attendee sys id to array
        gs.info("Avi: Attendees List: " + cbgr.attendee.getDisplayValue());
        }

        // Convert the attendees array to a comma-separated string to pass to Jelly
        var attendeesSysIds = attendeesid.join(',');

        // Pass the attendees string to the Jelly template
        attendeesSysIds;
    </g:evaluate>

    <!-- Use sys_ids to prefill list collector -->
    <g:macro_invoke macro="lightweight_glide_list" id="change_subsystem" name="change_subsystem" control_name="myListCollector" reference="sys_user" can_write="true" value="${attendeesSysIds}" />
    <p>Initial attendees: ${attendeesSysIds}</p>

    <!-- Displaying Attendees as List -->
    <table style="margin:20px 10px;">
        <tr>
            <td colspan="2"><strong>List of Attendees</strong></td>
        </tr>
        <tr>
            <td colspan="2">
                <ul>
                    <!-- Loop through the comma-separated list and display each one as a list item -->
                    <j:forEach var="jvar_attendee" items="${attendeesString.split(',')}">
                        <li>${jvar_attendee}</li> <!-- Display attendee names as list items -->
                    </j:forEach>
                </ul>
            </td>
        </tr>
    </table>

    <!-- Additional Content -->
    <table width="100%">
        <tr>
            <td />
            <td />
        </tr>
        <tr>
            <td>${gs.getMessage('Do you want to send the notification only to the new attendees or to all attendees?')}</td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <br />
                <g:dialog_buttons_ok_cancel ok="return sendToNew();" cancel="return sendToAll();" ok_type="button" cancel_type="button" ok_text="${gs.getMessage('Send to new')}" cancel_text="${gs.getMessage('Send to all')}" />
            </td>
        </tr>
    </table>
</j:jelly>


Client Script:

function sendToNew() {
	var gdw = GlideDialogWindow.get();
	var f = gdw.getPreference('sendToNew');
	if (typeof(f) == 'function') {
		f();
		return;
	}
}

function sendToAll() {
	var gdw = GlideDialogWindow.get();
	var f = gdw.getPreference('sendToAll');
	if (typeof(f) == 'function') {
		f();
		return;
	}
}

Processing Script:
-Empty I am not using any processing script

Please provide the approach or the solution or any link that can help me building this solution ASAP. This is on priority and as of now I am stuck I am trying hard but missing something as I didn't have worked much on the jelly scripting.


TIA

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@iva25 

you can pass sysId from UI action to UI page using this syntax and grab it and then use it further to set in glidelist macro

UI Action: How to send

dialog.setPreference('sysid', '<Your SysId>');

UI Page:

<g:evaluate var="jvar_sysid" expression="RP.getWindowProperties().sysid"/> 

<g:evaluate jelly="true" object="true" var="jvar_attendeearray">
		var sysId = jelly.jvar_sysId;
// now use this to query and hold the user sysIds in array and use in macro
		
	</g:evaluate>

<g:macro_invoke macro="lightweight_glide_list" id="change_subsystem" name="change_subsystem" control_name="myListCollector" reference="sys_user" can_write="true" control_name="QUERY:active=true^sys_idIN${jvar_attendeearray}" />		

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

Hi @iva25 ,

Here’s a working example I used on the Incident table to pass the assignment_group sys_id to a UI Page and display the group name using Jelly.


UI Action Script:

function openAssignmentGroupDialog() {
  var groupId = g_form.getValue('assignment_group');
  alert(groupId); // just to verify

  var dialog = new GlideDialogWindow('attendee_notifications_popup');
  dialog.setTitle('Assignment Group Info');

  dialog.setPreference('assignment_group_sys_id', groupId);
  dialog.render();
}

 

 UI Page Jelly Code:

<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide">

  <!-- Get sys_id from dialog preference -->
  <g:evaluate var="jvar_groupId">
    RP.getWindowProperties().get('assignment_group_sys_id');
  </g:evaluate>

  <!-- Get group name using sys_id -->
  <g:evaluate var="jvar_groupName">
    var name = '';
    var gr = new GlideRecord('sys_user_group');
    if (gr.get('${jvar_groupId}')) {
      name = gr.getValue('name');
    }
    name;
  </g:evaluate>

  <p><strong>Assignment Group Name:</strong> ${jvar_groupName}</p>
  <p><strong>Assignment Group sysId:</strong> ${jvar_groupId}</p>

</j:jelly>

This approach works perfectly for showing reference values in a UI Page passed via GlideDialogWindow.

 

Let me know if you need help expanding this!

 

Thanks and regards,
Siddhesh Jadhav


Please mark my answer helpful and accepted if it solved your problem.


SiddheshJadhav_0-1750530314891.png

 

Screenshot 2025-06-21 235557.png

 

SiddheshJadhav_1-1750530546833.png

 

View solution in original post

7 REPLIES 7

Hi @iva25 ,

Just checking in — did this solution work for you?
If it helped resolve your issue, kindly mark it as Accepted.

Let me know if you need any further assistance!

Thanks and regards,
Siddhesh Jadhav

Ankur Bawiskar
Tera Patron
Tera Patron

@iva25 

you can pass sysId from UI action to UI page using this syntax and grab it and then use it further to set in glidelist macro

UI Action: How to send

dialog.setPreference('sysid', '<Your SysId>');

UI Page:

<g:evaluate var="jvar_sysid" expression="RP.getWindowProperties().sysid"/> 

<g:evaluate jelly="true" object="true" var="jvar_attendeearray">
		var sysId = jelly.jvar_sysId;
// now use this to query and hold the user sysIds in array and use in macro
		
	</g:evaluate>

<g:macro_invoke macro="lightweight_glide_list" id="change_subsystem" name="change_subsystem" control_name="myListCollector" reference="sys_user" can_write="true" control_name="QUERY:active=true^sys_idIN${jvar_attendeearray}" />		

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@iva25 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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