In an application, users need to fill out a dynamic form consisting of different attributes and save this information in the system. These form fields are not predefined fixed fields, but are determined dynamically by the user or the system.
Scenario Steps:
- Creating a Dynamic Form:
- The application retrieves the attribute structure of the entity associated with the Get Entity Attributes action.
- Dynamic form components (input, dropdown, checkbox, date picker, etc.) are created based on this attribute information.
- The form contains the appropriate components for each attribute and is displayed to the user.
- User Data Entry:
- The user fills out the form. For example:
- Name (String)
- Date of Birth (Date)
- Subscription Status (Boolean)
- Number of References (Integer)
- Each value entered is stored in the form components.
- Creating the Model Object:
- All values in the form are collected in the system as a single model (JSON object).
- The model contains the following information for each attribute:
- EntityId: The ID of the related entity (e.g., customer ID)
- AttributeId: The ID of the attribute corresponding to each form field
- Value: The value entered by the user
- (If available) EntityValueId: The ID of the previously saved value (for updating)
- Triggering the Save Entity Value Action:
- After the user completes the form, they click the ‘Save’ button.
- The Save Entity Value action, which takes the form model as a parameter, is added to the OnClick event of the button.
- This action creates or updates all attribute values in the model in the system.
- Post-Process Feedback:
- If the record is successful, the message ‘Information saved successfully’ is displayed to the user.
- The form can be reset or the user can be redirected to other operations.
- If there is an error, an appropriate error message is displayed.