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

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



That works. Thanks, both, for your prompt responses 😊