Prefill form fields with the user information
Overview
You can prefill form fields in your custom workflow with the user information, such as user’s first and last name, email and username. The user provides this information during the initial registration, and it is stored in FA's Keycloak user object. When the workflow is triggered, FA passes the user information to the custom workflow.
User information fields
User information is saved in the form.startData.userProfile
process variable. The user attributes are:
form.startData.userProfile.given_name
– First name.form.startData.userProfile.family_name
– Last name.form.startData.userProfile.email
– Email.form.startData.userProfile.preferred_username
– User name.
On top of the above fields, the user object can have additional attributes depending on whether external identity provider is used for authentication or not. Attribute keys depend on your setup. Additional user data is available in the userProfile
object in the same way as the above attributes.
Prefilling process form fields
You can use the user data to prefill your form fields:
Navigate to your form and open the component's Edit window.
Navigate to the Data tab and scroll down to the Calculated Value section.
In the JavaScript section, set the "value" variable to be the user attribute you want. For example:
value = form.startData.userProfile.given_name
).
When you start your process, the form field will be prefilled with the user information.