Use custom field values in the External lookup

This example shows you to call the Workfront API and bring data from a custom field into your External lookup field. The example custom field is called “Custom Colors.”

  1. Open the custom form.

  2. On the left side of the screen, find External lookup and drag it to a section on the canvas.

  3. Enter the Label and Name for the field.

  4. Select the Format for the field.

  5. Enter the API URL call in the Base API URL field.

    Example
    $$HOST/attask/api/v18.0/PORT/search?ID={portfolioID}&fields=parameterValues

  6. Review the Dependencies for the fields that this lookup field is referencing in the API.

    A dependency field can be any custom or native field existing in the object’s details page.

  7. Select the HTTP Method.

    This will mostly likely be Get.

  8. Enter the JSON Path to get the results from your API call.

    Example
    $.data[*].parameterValues.["DE:Combo Colors"]

    • “parameterValues” refers to any custom field in Workfront for the object you’re on.
    • For this example, “DE:Combo Colors” is the specific custom field containing the values you want to retrieve.
    NOTE
    Header information is not required for a call to the same Workfront instance.
  9. Click Apply.

    When the custom form is added to a Workfront object, all of the values in the “Combo Colors” field appear in the External lookup field dropdown.

Set up an External lookup field for the Workfront Planning API

An endpoint is available in the Workfront Planning API to search records by record type ID through the Get method. You can use this endpoint to reference Planning records in External lookup fields.

  • Base API URL: $$HOST/maestro/api/v1/records/search?recordTypeId={recordTypeID}

  • HTTP Method: Get

  • JSON Path: $.records[*].data.{fieldID}

    {fieldID} is the field to display in the External lookup search results on the custom form for end users.

For more information, see Workfront Planning API.

Set up an External lookup field for a public API

You can use the External lookup to call an external, public API and retrieve data.

This example shows how to call an API of countries (such as https://api.first.org/data/v1/countries) so that you don’t have to hard code all of the country names in the dropdown options.

  1. Open the custom form.

  2. On the left side of the screen, find External lookup and drag it to a section on the canvas.

  3. Enter the Label and Name for the field.

  4. Select the Format for the field.

  5. Enter the API URL call in the Base API URL field.

    • You can add $$QUERY to implement query filtering for your end users.

    Examples
    Lists all countries: https://api.first.org/data/v1/countries

    Allows the user to search for any country in the dropdown field: https://api.first.org/data/v1/countries?q=$$QUERY

    Allows the user to search for a country in a region: https://api.first.org/data/v1/countries?region={DE:Region}&q=$$QUERY

    • The available regions are defined in a separate custom field in Workfront.
    • When the user selects a region on the form, then the External lookup field shows only the countries in that region (which country is in which region is defined in the API). The user can also search for a country in the selected region.
  6. Review the Dependencies for the fields that this lookup field is referencing in the API.

    A dependency field can be any custom or native field existing in the object’s details page.

    In this example, the {DE:Region} will be replaced with the value of the Region custom field.

  7. Select the HTTP Method.

    This will mostly likely be Get.

  8. Enter the JSON Path to get the results from your API call.

    This option allows extracting data from the JSON returned by the API URL. It serves as a way to select which values from inside the JSON will appear in the dropdown options.

    Example
    $.data[*].country

  9. (Optional) Click Add Header, and type or paste the key-value pair required for authentication with the API.

    NOTE
    The Header fields are not a secure place to store credentials, and you should be careful of what you enter and save.
  10. (Optional) Select Multi-Select Dropdown to allow the user to select more than one value in the dropdown.

  11. Click Apply.

    Setup of API call to public API in custom form

    When the custom form is added to a Workfront object (in this example, a project), it looks similar to this.

    Custom form with external lookup field

    External lookup options for a country based on region