<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Mobile Agent offline fetch script in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3471061#M5869</link>
    <description>&lt;P&gt;When downloading the cache for offline mode, I can only retrieve up to a maximum of 1,000 users from the sys_user table.&amp;nbsp; I have many more active users than this limitation.&amp;nbsp; I'm looking for guidance on creating an offline fetch script under input attributes for assigned to in my create interaction function. I need to dynamically fetch the logged in user's sys ID (gs.getUserID() and return results of any records on the user table who share the same location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will apply this same logic to any sys_user reference field for incidents and interactions.&amp;nbsp; Thanks for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;LI-MESSAGE title="Configuring Now Agent" uid="3437704" url="https://www.servicenow.com/community/developer-forum/configuring-now-agent/m-p/3437704#U3437704" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jan 2026 16:53:19 GMT</pubDate>
    <dc:creator>Jeff Lyons</dc:creator>
    <dc:date>2026-01-20T16:53:19Z</dc:date>
    <item>
      <title>Mobile Agent offline fetch script</title>
      <link>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3471061#M5869</link>
      <description>&lt;P&gt;When downloading the cache for offline mode, I can only retrieve up to a maximum of 1,000 users from the sys_user table.&amp;nbsp; I have many more active users than this limitation.&amp;nbsp; I'm looking for guidance on creating an offline fetch script under input attributes for assigned to in my create interaction function. I need to dynamically fetch the logged in user's sys ID (gs.getUserID() and return results of any records on the user table who share the same location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will apply this same logic to any sys_user reference field for incidents and interactions.&amp;nbsp; Thanks for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;LI-MESSAGE title="Configuring Now Agent" uid="3437704" url="https://www.servicenow.com/community/developer-forum/configuring-now-agent/m-p/3437704#U3437704" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2026 16:53:19 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3471061#M5869</guid>
      <dc:creator>Jeff Lyons</dc:creator>
      <dc:date>2026-01-20T16:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Mobile Agent offline fetch script</title>
      <link>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3471479#M5875</link>
      <description>&lt;P&gt;Hi Buddy,&lt;/P&gt;&lt;P&gt;Offline reference caching is capped at ~1,000 records, so you must filter sys_user instead of caching all&lt;/P&gt;&lt;P&gt;Here is the short version that works for Mobile / Now Mobile offline mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1) Script Include (server-side)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Create a Script Include to return active users in the same location as the logged-in user, plus the user themself.&lt;/P&gt;&lt;PRE&gt;var MobileOfflineUserFetch = Class.create();
MobileOfflineUserFetch.prototype = {
    initialize: function() {},

    getUsersByMyLocation: function() {
        var ids = [];
        var myId = gs.getUserID();
        var myLoc = gs.getUser().getLocation();

        ids.push(myId); // always include self

        if (!myLoc)
            return ids.join(',');

        var gr = new GlideRecord('sys_user');
        gr.addActiveQuery();
        gr.addQuery('location', myLoc);
        gr.setLimit(1000);
        gr.query();

        while (gr.next()) {
            ids.push(gr.getUniqueValue());
        }
        return ids.join(',');
    },

    type: 'MobileOfflineUserFetch'
};&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;2) Assigned To → OfflineFetchScript&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;On the Assigned to reference input (Create Interaction):&lt;/P&gt;&lt;PRE&gt;javascript&amp;amp;colon;new MobileOfflineUserFetch().getUsersByMyLocation()&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Result&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Offline cache stays under 1,000 records&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Users see &lt;STRONG&gt;only relevant users&lt;/STRONG&gt; (same location)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Reusable for &lt;STRONG&gt;Incident, Interaction, or any sys_user reference field&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/251444"&gt;@Jeff Lyons&lt;/a&gt;&amp;nbsp;- Please Mark &lt;FONT color="#0000FF"&gt;Accepted Solution&lt;/FONT&gt; and&lt;FONT color="#0000FF"&gt; Thumbs Up&lt;/FONT&gt; if you found Helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 03:42:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3471479#M5875</guid>
      <dc:creator>Matthew_13</dc:creator>
      <dc:date>2026-01-21T03:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Mobile Agent offline fetch script</title>
      <link>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3522651#M6607</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/342954"&gt;@Matthew_13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your solution and still could not get the user list for assigned_to reference input in offline mode.&lt;/P&gt;&lt;P&gt;For some reason assigned_to input's attribute&amp;nbsp;&lt;STRONG&gt;OfflineFetchScript&amp;nbsp;&lt;/STRONG&gt;with value = javascript&amp;amp;colon;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;new MobileOfflineUserFetch().getUsersByMyLocation()&lt;/PRE&gt;&lt;P&gt;just not working. No data brought back.&lt;/P&gt;&lt;P&gt;Interesting, when I set Conditions for online (for example: type=active^location=sys_id), offline uses this data to bring users back and not offline script fetch attribute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 17:49:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/mobile-agent-offline-fetch-script/m-p/3522651#M6607</guid>
      <dc:creator>nataliya_b</dc:creator>
      <dc:date>2026-04-09T17:49:44Z</dc:date>
    </item>
  </channel>
</rss>

