Displays a text box for the user to enter text and returns the text that the user entered.
prompt(message, pickList, fieldAreaWidth, fieldAreaHeight, password, required, defaultValue)
For a description of the business object categories, see Notes on "Enabled For".
|Business Object Category||Yes/No|
|Business Rules: Before-Save Rules||Yes1|
|Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load)||Yes|
|Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load)||Yes1|
|Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load)||Yes|
|Business Rules: Editing Rules||Yes2|
|Business Rules: Initialization Rules||Yes1|
|Business Rules: Read Only Rules||No|
|Business Rules: Required Rules||Yes2|
|Business Rules: Validation Rules||Yes1|
|Quick Actions (except UI Quick Actions)||Yes1|
|UI Quick Actions||No|
|Search/Dashboard without field references||Yes1|
|Search/Dashboard with field references||No|
|1. Except in services.|
|2. Except in services and when this field appears on a form or is triggered by such a field.|
This function takes at least one parameter and can take up to seven parameters. To enter a parameter without entering a value for a parameter before it, enter "" for the parameter for which you do not have a value. For example, to enter the message, pickList, and fieldAreaHeight parameters, but no fieldAreaWidth parameter, enter $(Prompt(message, pickList, "", 25)). In this example, the application uses 25 as the value of the fieldAreaHeight parameter and not the value of the fieldAreaWidth parameter.
The message that shows as a prompt.
(Optional) The name of a pick list that provides values for the user to select from.
If this parameter is null or empty, the function does not specify a list but displays a text box instead.
(Optional) The width of the text area in pixels.
(Optional) The height of the text area in pixels.
(Optional) Can be either true or false.
If true, the application treats the entered text as a password and displays it as asterisks when entered.
(Optional) Can be either true or false.
If true, the user must enter or pick a value.
|defaultValue||(Optional) The text value to return if the user does not enter anything or select a value.|
The following is an example of using this function in a quick action:
$(Prompt("Select Cause Code", "Incident Cause Code", 400, 200, false, true))
In this example, the required parameter is set to true, because the application prompts the user for a value that is required. This is to ensure that the user specifically chooses a proper value before the quick action is executed. In this example, there is no default value provided so there is no defaultValue parameter and therefore the function only has six parameters.
Add the following expression to the Resolution field of the Update Object quick action for an incident:
$(Prompt("Please enter resolution", "", 400, 200))
This returns a prompt for a resolution note with an empty text area that is 400 pixels in width and 200 pixels in height.
Another example is in the Social Board where a quick action creates a business object.
$(Prompt("Summary", "", 350, 25, "", "", "_ConversationTitle_"))
$(Prompt("Description", "", 400, 200, "", "", "_ConversationContent_"))
In the first instance, the original post is included in the Summary field. In the second instance, the original post and the comments are included in the Description field.
You also can use this function in a saved search, to prompt an employee team when the search is being run.
You can use the Prompt() function in the context of the Update Object quick action to ask the user to fill out a value for a field in the business object. This is typically used when the underlying field is also validated.
There are two variations of the Prompt() function:
If the second parameter is an empty string, you can enter any value for the field.
If the second parameter is a text value, the application assumes that this value is a named validation list and uses it to constrain the allowable values that you can enter for the field.
The following Prompt() function updates the owner team for an incident:
$(Prompt("Incident Owner Team", "Team of StandardUserTeam used in Incident"))
The following example shows the syntax in the existing Reassign Owner Team quick action in for an incident:
Prompting for a Value in a Quick Action Example