Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get the missing or error users

Pranay Verma
Tera Contributor

Hello Team,

 

i am trying to upload users in azure ad using excel sheet in flow designer but few of them users are not adding and showing error " User not found" so i want to print the names of those missing users in RITM worknotes.

PranayVerma_0-1710822531136.png

 

2 REPLIES 2

Amit Pandey
Kilo Sage

Hi @Pranay Verma 

 

Please try this-

 

var failedUsers = "Amit Pandey, Pranay Verma"; // Assume this string is built during your flow's execution
var ritmSysId = "your_ritm_sys_id_here"; // Pass the RITM sys_id

if (failedUsers) {
    var ritmGr = new GlideRecord('sc_req_item');
    if (ritmGr.get(ritmSysId)) {
        ritmGr.work_notes = "Failed to add/update the following users in Azure AD: " + failedUsers;
        ritmGr.update();
    }
}

Amit Verma
Kilo Patron
Kilo Patron

Hi @Pranay Verma 

 

You can put your action to Add User to Group in a try block and in the if error occurs block, you can collect the failed users in a flow variable. You can then make use of Update Record to update the RITM worknotes.

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.