Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel

Table of Contents
maxLevel3

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. 

...

  1. Add Dynamic Choice fields to the "UE Task" Universal Template.
  2. Add backing implementation for Dynamic Choice fields to the extension.py file in the sample-task Extension project.
  3. Rebuild and upload the modified Extension.
  4. 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
titleNote

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
titleClick here to expand uip-cli details...

Step 3 Supplemental - Build and Upload the Extension Zip Archive Using the CLI

Save 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). 

...

  1. Select the ue-task-test (or whatever name you gave it) task
  2. Select an active agent of version 7.0.0.0 or higher for the task to run on.
  3. 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.



    Upon clicking the Submit button, the Primary Choice Field search icon will turn grey for a moment while the Dynamic Command request is sent down to the Agent and results are returned to populate the drop-down.

    When the operation is complete, the icon will turn green again and the Primary Choice drop-down will be populated with the values supplied by @dynamic_choice_command("primary_choice_field") code in the extension on the Agent system.

    You have just executed a Dynamic Choice Command from the "Primary Choice" Dynamic Choice field!

    Note
    titleNote

    By clicking the search icon for the first time, the Controller automatically re-deployed the modified Extension archive to the target agent.


    Select a value from the “Primary Choice” drop-down.


  4. 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
titleClick here to expand uip-cli details...

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.


< Previous     Next >