REST - GetChoiceLineId
The EWGetChoiceLineID REST operation:
- Obtains the internal identifier that corresponds to a choice value for use in SQL-based expressions.
- Accepts the URL with parameters as per general URL conventions which can be viewed in the REST Interface Overview. Additionally, the URL must contain the name of the choice field and the choice list element value.
- Supported Content-Type: application/x-www-form-urlencoded
- This returns the identifier of the choice list element suitable to use in EWSelect.
All parameters including the choice text value must be properly URL-encoded.
EWGetChoiceLineId to obtain the internal identifier that corresponds to the choice text value for further use in SQL-based expressions. This is needed for the "where" parameter of
EWSelectFromTable or the query text when forging links to other tables via Linked Field sets.
SQL-based expressions are evaluated on the database level where choice values are stored as identifiers. These identifiers change if the knowledgebase is copied or re-imported, or the values in the choice list are re-created. It is therefore advisable to use the
EWGetChoiceLineId call to obtain the ID value at runtime immediately before the SQL call.
If the factors that trigger the change of the internal choice identifiers, for instance knowledgebase copy or re-import, or choice list values are re-created, are detected on the client, then the values returned by this call can be safely cached on a per KB basis between multiple calls.
Assume an instance of Agiloft is available on localhost, port 8080 and is called "Demo". Obtain the identifier for choice value 'High' for the field 'Priority' in the table 'Case'.
The following request is issued:
If there were no matching choice list values found, the HTTP code 400 will be returned with a brief explanation of the problem.
The following result will be returned in the case of the text value being successfully translated into a numeric identifier: