You can accomplish this by utilizing the custom command: edit.display-add-related-feature
. Below is an example of how to add a feature to the Fire_Hydrant_Surveys table in the VSW Capital City Sample App:
The most straightforward approach would be to configure the custom command (
edit.display-add-related-feature
) as a menu item in the Feature Actions of the Hydrants layer. This can be done in the designer by navigating to the components list and selecting Map > Layer Extensions > Fire Hydrants > Feature Actions > +Add Menu Item > Scroll down to Custom Command:Subsequently, you may utilize the following command text and specify the
relationshipId
argument as 1, as this was the value for the relationship from the REST endpoint. Other necessary arguments are automatically passed to the command from its execution context; for instance, it recognizes that it is operating on the identified feature from the hydrants layer.{ "name": "edit.display-add-related-feature", "arguments": { "relationshipId": "1" } }
- When you identify a fire hydrant, you will observe a feature-specific action button that executes your new command and opens a form for editing or creating the new related feature:
You may also adjust the behavior using some of the other input arguments outlined in the API documentation. For instance, if you wish to make the Survey Date field a mandatory entry in the form, you could use the complete command input below, which includes an additional fieldElements
argument:
[ { "name": "edit.display-add-related-feature", "arguments": { "relationshipId": "1", "fieldElements": [ { "fieldName": "SURVEY_DATE", "requiredExpression": "true" } ] } } ]
Certainly, executing the command from the Feature Actions menu is advantageous as it provides the appropriate context for the command arguments. However, you may also utilize the command in a workflow Run Command activity with manually specified arguments if you have an alternative use case in mind.
Comments
0 comments
Article is closed for comments.