# Prompt inside a function

**URL:** https://discourse.nodered.org/t/prompt-inside-a-function/59459
**Category:** General
**Created:** [6 March 2022 22:56 UTC](https://discourse.nodered.org/t/prompt-inside-a-function/59459 "2022-03-06T22:56:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)
#### Post date: [6 March 2022 22:56 UTC](https://discourse.nodered.org/t/prompt-inside-a-function/59459/1 "2022-03-06T22:56:11Z")

</div>

Hi all!

I need to use a function to prompt for a film name the send that to a payload in order to obtain the result and work with that result later.

I'm getting only wrong result. So far i have this.

```auto
var filmName = '';

msg.payload = filmName;

return msg;

```

Thanks in advance!

Regards

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [7 March 2022 01:01 UTC](https://discourse.nodered.org/t/prompt-inside-a-function/59459/2 "2022-03-07T01:01:02Z")

</div>

Flows run without user intervention so you cannot prompt a user for a value in a flow as it doesn't make sense.

What you need to do is create a UI for user input and incorporate that into your flow. Dashboard is the simplest approach to do this.

---

<div class="post-metadata">

### Author: ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)
#### Post date: [7 March 2022 03:04 UTC](https://discourse.nodered.org/t/prompt-inside-a-function/59459/3 "2022-03-07T03:04:38Z")

</div>

Hi!.

Yeah, you're right about make a user input with the dashboard. But i think that it also can be managed within a function node because there you can write the question and capture the answer, for example, "how old are you?".

I mean, if I do it the same way as i write on a JS script so it can be done here.

Regards.

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [7 March 2022 04:22 UTC](https://discourse.nodered.org/t/prompt-inside-a-function/59459/4 "2022-03-07T04:22:16Z")

</div>

No - flows do not interact with the user - that is the job of the dashboard

The usual way is to (as Julian said) have a text/prompt in the dashboard, grab that in msg.payload or similar and then pass that to your function node

Craig

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [6 May 2022 04:22 UTC](https://discourse.nodered.org/t/prompt-inside-a-function/59459/5 "2022-05-06T04:22:54Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
