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  

How to script name value pair in Flow Designer?

gjz
Mega Sage

I need some help getting a value from a name/value pair variable in a Look Up Record action in Flow Designer.

 

My flow is triggered from an inbound email, which is used to submit a catalog item.

 

Since you can't parse the body of an email in flows I used Ben Scherer's "Parse Email Flow Action" action, which works great.  However, it parses the UserID field in the body of the email as a string and on the catalog item the corresponding field is Requested for, which is a reference field and the Submit Catalog Item Request action won't allow me to use the UserID variable in the Requested for field.

 

I though I could solve the problem by doing a Look Up Record action before submitting the catalog item to get the user sys_id, but I'm not sure how to script it.  Can anyone help me with that?

 

Here's what I have available to use for the script:

gjz_0-1683233364310.png

To use the Email variables to submit the catalog item, you have to use the name/value function:

gjz_1-1683233475769.png

 

But, I can't access the value in the email variable using a function in the Look Up Record action:

gjz_2-1683233568601.png

So I thought I would script it instead - and that's where I'm stuck.  This is as far as I get.  How can I get the value so that I can return the sys_id to set the Requested for in the Submit Catalog Item Request action?

gjz_3-1683233647121.png

Here's the flow:

gjz_4-1683233855271.png

 

4 REPLIES 4

asifnoor
Kilo Patron

Hi,

I suggest you write a custom action which takes the input as user_id and return the sys_id back to the flow.  You are anyway getting the user_id from your earlier action, pass that to your custom action, in that add a script step, do a gliderecord and return the sys_id as output variable.

 

Mark the comment as a correct answer and also helpful if this helps to solve the problem.

-O-
Kilo Patron

It would be:

 

fd_data._1__parse_email_body_test.email_variables['<name of the variable>']

 

-O-
Kilo Patron

But I strongly recommend replacing inline scripts that refer to data pills with (custom) Actions: sooner or later you will have to insert an action or logic or sub-flow and suddenly your inline scripts no longer work as they refer to non-existing data pills. You do not run that risk when using Actions.

DuangrutA
Tera Contributor

While I am using the same  "Parse Email Flow Action" action. My flow is failed to get value from 'Get Item Name/Value pairs'

I am using Subflow to create datapill and return it to Flow to submit a catalog item.
Subflow : Assign Subflow Outputs inline script

var  name = fd_data._1__parse_email_body_test.email_variables['<name of the variable>'];
return name;

 

_1__parse_email_body_test << It's work even the name on step one doesn't match.

Thank you very much!