Flow Designer Look Up Record action returning 'record not found' using action output variable

Scott Eaglesham
Tera Expert

Looking up a sys_user record using the following results in a successful look up.

ScottEaglesham_0-1741097765025.png

 

However, using the following results in 'No record found'

ScottEaglesham_1-1741097765028.png

 

'Extract string email address 1>email' is the output from action...

 

(function execute(inputs, outputs) {

var inputstring = inputs.string

/*extract email address from string with line containing Email: email address*/
var startindex = inputstring.indexOf("Email:");
var endindex = inputstring.indexOf("Dept:");
var email = inputstring.substring(startindex+7,endindex);

outputs.email=email

})(inputs, outputs);

 

...where inputstring is...

 

FormID: 65

UserID: NHSH\seagl01
Logged-in as NHSH\seagl01
Name: Scott Eaglesham (NHS Highland)
Email: scott.eaglesham@nhs.scot
Dept: eHealth Services

 

Execution details as follows...

ScottEaglesham_2-1741097765030.png

 

I have tried with action output variable 'email' as String and Email types, with the same result.

1 ACCEPTED SOLUTION

Siddhesh Gawade
Mega Sage

Hello @Scott Eaglesham ,

 

I guess the issue is whitespaces can you try:

var email = inputstring.substring(startindex+7,endindex).trim(); Instead 

var email = inputstring.substring(startindex+7,endindex);

It will remove all spaces if there are any!

Kindly mark the answer ✔️ Correct or Helpful ✔️ If it addresses your concern.


Regards,

Siddhesh



View solution in original post

6 REPLIES 6

Dr Atul G- LNG
Tera Patron

Hi @Scott Eaglesham 

change operation to look up records. from look up record

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Many thanks for the prompt response.

 

Using Look Up Records results in the following.

ScottEaglesham_0-1741100230216.png

 

Also, what I' m actually trying to do is to look up the user record with the specified email address to use to set the caller_id in an incident record in a subsequent stage in the flow. Will Look Up Records allow me to do this?  I can do so using Look Up Record with condition email=scott.eaglesham@nhs.scot.

Yes @Scott Eaglesham 

Look up record will work.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

I'm afraid I'm getting the same result using Look Up Records as I do using Look Up Record. In both cases using the action output variable, email, in the condition results in no records found, and setting the email field explicitly to an email address in the condition results in a record being found.