Assign ServiceNow ITIL License Maximum Limit by using Flow Designer

Rajesh Bandila
Tera Contributor

Hi Everyone,

 

I have created the catalog item(with Flow Designer) to submitting the user to get ITIL access in ServiceNow. I have an requirement now, We have a total of limit 600 ITIL licenses.
If a user submits a request for an ITIL license and the current count is below 600, the request should be processed as usual. If the count has reached 600, the request state should be set to “Pending”. Once a license becomes available, the system should automatically process the pending request.

However, the challenge lies in automatically processing the “pending” request once a license becomes available. Could you please let me know, how to achieve this with in the Flow Designer?

script:

 

(function execute(inputs, outputs) {
    var user = new GlideRecord('sys_user');
    user.addActiveQuery();
    user.query();
    var count = 0;
    while (user.next()) {
        var role = new GlideRecord('sys_user_has_role');
        role.addQuery('user', user.sys_id);
        role.addQuery('role.name', 'itil');
        role.query();
        if (role.hasNext()) {
            count++;
        }
    }
    gs.print(count);

    if (count >= 600) {
     
        var request = new GlideRecord('your_request_table');
        if (request.get(inputs.request_sys_id)) {
            request.state = 'Pending';
            request.update();
        }
    } else {
        
        }
    }
})(inputs, outputs);

 

Thanks,

Rajesh

2 REPLIES 2

Anwesha3
Mega Guru

Hi @Rajesh Bandila  of the else part you will need async BR or you can call another subflow from the mail flow that will run in every 1 hour to check if the count is less than 600. 

in the given script it wont run continuously to keep checking if the count is getting below 600 .

Kindly mark the reply as a correct answer / helpful if it helped to solve your question.

Thanks,
Anwesha

 

ersureshbe
Giga Sage
Giga Sage

Hi,

 

I would like to inquire about the methods you are employing to ensure the effective utilization of the license pool within the instance. As you know, ServiceNow operates under a 'Fixed' license model, and there is no inherent 'Floating' license concept in the out-of-the-box configuration. Have you implemented any customizations to facilitate the management of 'Floating' license logic? If so, could you please clarify the criteria for releasing these licenses based on the state you have established for the requests?

 

Regards,
Suresh.