IBM Security SOAR

Expand all | Collapse all

Manipulate select field values in data table

  • 1.  Manipulate select field values in data table

    Posted Mon June 28, 2021 10:01 PM
    Is it possible to programmatically manipulate the values for a field in a data table?
    I have a data table with a select field called "A" and text area field called "B".
    The select field "A" has values "x" and "y" that can be selected when creating a new row.,
    Is there a way to add a new value "z" to the "A" select field programmatically?

    ------------------------------
    Tim Gray
    ------------------------------


  • 2.  RE: Manipulate select field values in data table

    Posted Tue June 29, 2021 08:41 AM
    Hi Tim,

    In the Cisco ASA resilient community app, the firewall select field is not known till run time
    so I implemented using GET/PUT on the select list for the rule activity field popup when the app starts up.

    Here is an example from the integration:
    def init_select_list_choices(rest_client, field_name, field_value=None):
        """
        Update the rule activity select field choices at run time.  
        We do not know the firewall and network object group lists till run time as
        these are defined by the user in the app.config.  
        """
        try: 
            # Get the current firewall rule activity select list.
            uri = "/types/actioninvocation/fields/{0}".format(field_name)
            get_response = rest_client.get(uri)
    
            values = []
    
            # Add each firewall as a select list entry.
            for label in field_value:
                entry = {'label': label,
                         'enabled': True,
                         'hidden': False}
                values.append(entry)
    
            # Put the new values into the select list to replace the current values there.
            get_response['values'] = values
            put_response = rest_client.put(uri, payload=get_response)
    
            return put_response
    
        except Exception as err:
            raise IntegrationError(err)​

    This code is located in our github here.

    Hope this helps!

    AnnMarie



    ------------------------------
    AnnMarie Norcross
    ------------------------------



  • 3.  RE: Manipulate select field values in data table

    Posted Tue June 29, 2021 09:15 AM
    The API you are looking for is in the TypeREST endpoint. Specifically

    PUT /orgs/{org_id}/types/{type}/fields/{field}


    Here is body content that adds/updates two values to the field for the data table:

    {
      "id": 1563,
      "name": "multiselect",
      "text": "multiselect",
      "input_type": "multiselect",
      "uuid": "906b1926-ac17-4dcf-b7a1-3f8e32126ee5",
      "values": [
        {
          "value": 4005,
          "label": "3",
          "enabled": true,
          "hidden": false,
          "default": false
        },
        {
          "value": 2,
          "label": "4",
          "enabled": true,
          "hidden": false,
          "default": false
        }
      ]
    }​

    Ben



    ------------------------------
    Ben Lurie
    ------------------------------



  • 4.  RE: Manipulate select field values in data table

    Posted Wed June 30, 2021 04:41 PM
    Thanks for your responses! This really helped.

    ------------------------------
    Tim Gray
    ------------------------------