Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Flow designer always returning as 0

Prasun Sarkar7
Tera Expert

Hi I made a inbound flow where I am checking how many client visbility the user has on that basis I am actually sending an email if it is greater than 1 we are not creating a case and sending an email. I tried everything script include action everything this is my screenshot of the script include code and below that in the flow how I am calling it. When the flow is triggering via inbound action then this value is alwys 0 but when I am testing the flow using the same record or any other record its coming as 2.

PrasunSarkar7_0-1762258617541.png

PrasunSarkar7_1-1762258665230.png

 

 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Prasun Sarkar7 

if your script include is server side then where is initialize() method.

your syntax for script include is wrong.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

No its not i tried in the background script its working and also returning value. And I tried without the script include in flow I hard coded this code in the flow to a flow variable its still returning 0

var DomainQuery = new GlideRecord("sys_user_visibility");
//DomainQuery.addQuery("user",fd_data._2__look_up_record.record.sys_id);
DomainQuery.addQuery("user","992376f11bf4e2505745620ee54bcb66");

DomainQuery.query();
var count=0;
while (DomainQuery.next()) {
   count++;
}
return count;

PrasunSarkar7_0-1762260582777.png

 

@Prasun Sarkar7 

when flow runs it's running with system user or other user?

did you add logs and see if script include got called when flow runs?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Its running as system user in the flow and I put logs in both flow and script its returning 0 from the script also 

PrasunSarkar7_0-1762262313955.png