Detailed examples of using the $(prompt()) function

Version 1

    Details

    Detailed use examples of the $(Prompt()) function


    Resolution

    Here is an example of prompting a user for minutes entered, on an Incident worked. For this example, create a quick action on the Incident object, as an UpdateObject action, for the field that is needed to put the minutes into. For the sake of ease, have the users enter the minutes into the description:

     


    The prompt function is used in the field value, so that when the user executes the action, it will prompt them for the value to be put into the description.  As a quick example, we can use this syntax:

     

    $(Prompt("Enter minutes worked: ",  ""))

    The user will receive a prompt like this, when they execute the action:

     


    When the user enters “4” and hits “OK”, the description field would be populated with “4”.

    As further example, if the user wanted to limit the input area to 100x100, we could use the following:

    $(Prompt("Enter minutes worked: ",  "", "100", "100"))


    If the user had a picklist called “MinutesWorked”, that only has integers 1-500 available in it and wanted to use that, in order to pick from a drop-down, the below example could be used:

    $(Prompt("Enter minutes worked: ",  "MinutesWorked"))


    The important thing to remember about prompts, is that although you can use it to prompt for a value to fill any field, whether it’s read-only, displayed on a form, or not; you MUST use it only in a context where the user will receive a prompt and be able to respond to it. For example, it will work in a quick action, or most business rules, but it will not work in a workflow, where the system is executing it, rather than a user that can respond to the prompt.