# User Input

The current iteration of runtime prompts require the user to generate the document through our older method involving VisualForce pages. As we navigate to leveraging invokable SDK document generation, Screen Flow Prompts are available as alternative to runtime prompts. Screen Flow Prompts provide the ability for admins to set up a screen flow, collect the inputs into a collection and populate the inputs onto the generated document.

{% hint style="info" icon="memo-pad" %}
Note: This document is specific for a need of leveraging runtime prompts with invokable SDK. If the client has an existing APEX class with mapped inputs they want to put into the document, you may want to guide them to leveraging callables.
{% endhint %}

{% hint style="danger" %}
Does not support:

* S-Sign
* non-PDF templates (DOCX, XLSX, XLS, etc.)
* Emailing from S-Docs
* Communities/Experience Cloud
* Translations
  {% endhint %}

### How To Create A Basic Screen for ScreenFlow

#### Setup the Screen

1. Go to Setup > Process Automation >Flows and Click New Flow
2. Choose Screen Flow and click Create
3. Click the + sign below the start button and choose Screen Flow
4. Each screen will need a label and API name. This screen Label/API name will be referenced in the assignment when searching for the screen component input.
5. Each input field will need a label and API name. This screen Label/API name will be referenced in the assignment when searching for the screen component input. Add your desired inputs into the screen, add a label/API name, click Done

### Create the Collection Variable

A minimum of two variables are required. 1 collection variable and one variable for each screen input you wish to collect information from. These steps will show how to create the collection variable.

1. Click on the Toggle Toolbox button
2. Click on New Resource
3. Input the following values:
   1. Resource Type : Choose **Variable**
   2. API Name : **\[Custom Variable Name]** **(userinputcollection)**
   3. Data Type : **Apex-Defined**
   4. Allow multiple values (collection) : **Checked**
   5. Apex Class : **SDOC.UserInput**
   6. Availability Outside the Flow : Available for Input / Output **Checked**

### Create the Input Variable

A minimum of two variables are required. 1 collection variable and one variable for each screen input you wish to collect information from. These steps will show how to create the input variable.

1. Click on the Toggle Toolbox button
2. Click on New Resource
3. Input the following values:
   1. Resource Type : Choose **Variable**
   2. API Name : **\[Custom Variable Name]** **(userinputtext)**
   3. Data Type : **Apex-Defined**
   4. Allow multiple values (collection) : **Unchecked**
   5. Apex Class : **SDOC.UserInput**
   6. Availability Outside the Flow : Available for Input / Output **Checked**

### Create the Assignment

1. Click the + sign and Choose Assignment
   1. Label : ScreenFlowPrompt
   2. API Name : ScreenFlowPrompt
2. You will need to add three variable values. One for the merge field label you will use in the template, one to collect the value from the screen flow and one to place the userinput variable into the userinput collection.
   1. Userinput Merge Field Label - The same text used here
      1. Userinput mergeField Label:
         1. Variable : \[Custom Variable Name].mergeField **({!userinputtext.mergeField})**
         2. Operator : Equals
         3. Value : \[MergeFieldLabel] **(Merge field label used in your template source)**
   2. 1. Userinput value:
         1. Variable : \[Custom Variable Name].value **{!userinputtext.value}**
         2. Operator : Equals
         3. Value : \[Screen Component Variable]
   3. 1. Userinput collection:
         1. Variable : {!userinputcollection}
         2. Operator : Add
         3. Value : \[Apex-Defined Variable]

            \
            Example:

### Add your Action(s)

1. Action: **Generate S-Docs With Input**
   1. Click the + sign below the start button and choose Action
   2. Search for the S-Docs Category
   3. Choose **Generate S-Docs With Input**
   4. Set Input Values for the Selected Action
      1. Label : \[Action Label]
      2. API Name : \[Action API Name]
      3. Object Id : \[Base Record ID]
      4. Template Name or Id : \[Template Name or Template ID]
      5. User Inputs : \[User Input Collection Variable] **({!userinputcollection})**

         \
         Example:
2. Action: **Create PDF File from S-Doc**
   1. Click the + sign below the start button and choose Action
   2. Search for the S-Docs Category
   3. Choose **Create PDF File from S-Doc**
   4. Set Input Values for the Selected Action
      1. Label : \[Action Label]
      2. API Name : \[Action API Name]
      3. S-Doc Id : \[Output from Generate S-Docs With Input].SDoc.Id **({!DOCGEN.sdoc.Id})**

Example:

### How to the Create Template

Taking the collection of screen inputs and placing it into the template is simple.

1. Identify the \[MergeFieldLabel]\(s) created
2. Place them into the template source as such:
   1. {!MergefieldLabel}
   2. **Example:** **{!textEntry}**

### Related articles

The content by label feature automatically displays related articles based on labels you choose. To edit options for this feature, select the placeholder and tap the pencil icon.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sdocs.com/developer-hub/references/software-development-kit-sdk/user-input.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
