Panel | ||||
---|---|---|---|---|
|
Introduction
On this page, we will enhance the ue-task Extension developed in the previous chapter by adding two Dynamic Choice Fields to the "UE Task" template. A corresponding change will be made in extension.py to implement the functionality that will populate the Dynamic Choice Fields.
...
- Add Dynamic Choice fields to the "UE Task" Universal Template.
- Add backing implementation for Dynamic Choice fields to the extension.py file in the sample-task Extension project.
- Rebuild and upload the modified Extension.
- Populate the Dynamic Choice fields on a task definition form.
Step 1 - Add Dynamic Choice fields to the "UE Task" Universal Template
Go back to the "UE Task" Universal Template form.
...
Click the "Save" icon to save the field.
Step 2 - Add backing implementation for Dynamic Choice fields to extension.py
Open file ~/dev/extensions/sample-task/src/extension.py
in your editor of choice.
...
Note | ||
---|---|---|
| ||
The value supplied to the dynamic_choice_command decorator must match the field name of the associated Dynamic Choice field in the Controller's Universal Template (for example, @dynamic_choice_command("primary_choice_field")). |
Step 3 - Build and Upload the Extension Zip Archive Using the UIP VS Code Extension
Save all changes to extension.py.
...
Expand | ||
---|---|---|
| ||
Step 3 Supplemental - Build and Upload the Extension Zip Archive Using the CLISave all changes to extension.py. From the command line, cd to the sample-task directory and execute the push command as shown below: Recall that the push command builds and uploads the Extension zip archive |
Step 4 - Experience the Dynamic Choice Fields in Action
In the Controller, if the UE Task Tasks tab is open, close it now (required to pick up the addition of the Dynamic Choice fields).
...
- Select the ue-task-test (or whatever name you gave it) task
- Select an active agent of version 7.0.0.0 or higher for the task to run on.
Click on the “Primary Choice Field” search icon to initiate a Dynamic Command call. Clicking on the “Primary Choice” search icon will open the following dialog. Click the “Submit” button.
Note title Note - Follow the previous procedure from “3” to execute the Dynamic Choice Command search for the “Secondary Choice field” and select a value from the populated dropdown.
Save the task
Step 5 - Update the Local template.json
In step 1, we modified the Universal Template by adding new Dynamic Choice Fields. Recall that inside ~/dev/extensions/sample-task/src/templates, there is a template.json file. This file should correspond to the Universal Template in the Controller.
Right now, they are not both the same. The Controller's version of template.json has the Dynamic Choice Fields changes. To grab those changes, use the pull command as shown below:
UIP VS Code Extension
Expand | ||
---|---|---|
| ||
Step Supplemental - CLI |
Now, both the local and Controller's version of the Universal Template are the same.
It is a good practice to keep both of them in-sync. Otherwise, one or the other could be overwritten. For example, if the local template.json does not contain any new changes that the Controller's version of Universal Template does, then issuing the UIP: Push All or push -a command will overwrite the Controller's version of the Universal Template.