<?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 Make Locked User Accounts Available from Service Catalog in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244431#M1197288</link>
    <description>&lt;P&gt;We have a catalog item to allow equipment to be returned after an employee has left the company. Selecting the employee (from sys_user) brings up a list of assets assigned to that user. This all works great, except for when the employee being offboarded is marked locked on their user record (sys_user). There is a business rule "user query" that prevents locked accounts from being viewed by role admin and user_admin. Easy enough to remove the restriction but then any menu referencing user records will show the locked users: Ex: assigned to on incident, change, sc_task, ritm. (as well as other places). We don't remove group membership when a user offboards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on how else this might be achieved?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 22 Apr 2025 15:15:04 GMT</pubDate>
    <dc:creator>fcaruso123</dc:creator>
    <dc:date>2025-04-22T15:15:04Z</dc:date>
    <item>
      <title>Make Locked User Accounts Available from Service Catalog</title>
      <link>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244431#M1197288</link>
      <description>&lt;P&gt;We have a catalog item to allow equipment to be returned after an employee has left the company. Selecting the employee (from sys_user) brings up a list of assets assigned to that user. This all works great, except for when the employee being offboarded is marked locked on their user record (sys_user). There is a business rule "user query" that prevents locked accounts from being viewed by role admin and user_admin. Easy enough to remove the restriction but then any menu referencing user records will show the locked users: Ex: assigned to on incident, change, sc_task, ritm. (as well as other places). We don't remove group membership when a user offboards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on how else this might be achieved?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 15:15:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244431#M1197288</guid>
      <dc:creator>fcaruso123</dc:creator>
      <dc:date>2025-04-22T15:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Make Locked User Accounts Available from Service Catalog</title>
      <link>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244524#M1197315</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/658971"&gt;@fcaruso123&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I have tried this approach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this and let me know&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.store session client data on for the logged in user on the load of the catalog item&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;create a client callable script include&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var testQueryonBR = Class.create();
testQueryonBR.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    putClientDataForCatalog: function() {
        gs.getSession().putClientData('allowToViewLockedUsers', this.getParameter('sysparm_allow'));
		return gs.getSession().getClientData('allowToViewLockedUsers');
    },
    getClientData: function() {
        return gs.getSession().getClientData('allowToViewLockedUsers');
    },

    type: 'testQueryonBR'
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and an onload client script to put client data which allows them to see the inactive users&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onLoad() {
    //Type appropriate comment here, and begin script below

    var k = new GlideAjax('testQueryonBR')
    k.addParam('sysparm_name', 'putClientDataForCatalog');
    k.addParam('sysparm_allow', 'true')
    k.getXMLAnswer();

}&lt;/LI-CODE&gt;&lt;P&gt;and an onsubmit client script to hide inactive users&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onSubmit() {
    var k = new GlideAjax('testQueryonBR')
    k.addParam('sysparm_name', 'putClientDataForCatalog');
    k.addParam('sysparm_allow', null)
    k.getXMLAnswer();

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and update the BR script with&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (!gs.getSession().getClientData('allowToViewLockedUsers'))
    current.addActiveQuery();&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChaitanyaILCR_0-1745338457272.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/437032iAE85701260B068B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChaitanyaILCR_0-1745338457272.png" alt="ChaitanyaILCR_0-1745338457272.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the only issue I can see with this approach is&amp;nbsp;&lt;/P&gt;&lt;P&gt;user opens the catalog form and doesn't submit&amp;nbsp;&lt;/P&gt;&lt;P&gt;in this scenario the user can view the in active user until they end their session(log out)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;put an or condition in the BR to allow any other roled to users to see the inactive users&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Please mark my answer as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;helpful/correct&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;if it resolves your query.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;Regards,&lt;BR /&gt;Chaitanya&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 16:18:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244524#M1197315</guid>
      <dc:creator>Chaitanya ILCR</dc:creator>
      <dc:date>2025-04-22T16:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Make Locked User Accounts Available from Service Catalog</title>
      <link>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244527#M1197317</link>
      <description>&lt;P&gt;I actually built out something similar for our HR team so that inactive profiles can be selected on certain HR Catalog Items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The key to this is that you will need to add a new custom field to the "sys_user" table for something like "u_show_inactive" and then pre-populate this on all records. Then on the catalog item in the reference field that points to "sys_user" you would add a simple filter of&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"active = true" OR "u_show_inactive=true"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should then allow you to see/select these profiles even though they are actually inactive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now if you are wanting to do any additional data queries, you will need to do further scripting based on a client script and script include as server-side scripting can get around the business rule restriction. Or in some circumstances it's possible to use a "reverse" query to get around the business rule such as in this line of syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;grUser&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;next&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt; &lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; &lt;SPAN&gt;!&lt;/SPAN&gt;&lt;SPAN&gt;grUser&lt;/SPAN&gt;&lt;SPAN&gt;.active)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Apr 2025 16:19:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3244527#M1197317</guid>
      <dc:creator>Ian Mildon</dc:creator>
      <dc:date>2025-04-22T16:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Make Locked User Accounts Available from Service Catalog</title>
      <link>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3259529#M1201205</link>
      <description>&lt;P&gt;Appreciate the responses. Decided to go a different direction. Since there is currently only one catalog item that needs access to inactive user records, I wrote a script include which performs a gliderecord search of sys_user with the ignore business rule option. User enters the unique ID of employee and an Ajax call returns the attributes necessary to process the request.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 19:41:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/make-locked-user-accounts-available-from-service-catalog/m-p/3259529#M1201205</guid>
      <dc:creator>fcaruso123</dc:creator>
      <dc:date>2025-05-09T19:41:15Z</dc:date>
    </item>
  </channel>
</rss>

