Many of the keywords defined in text_api.cfg have an associated method to convert the value specified to a value that is appropriate for storage in the database. This feature lets users specify values just as they would in the web interface without having any knowledge of the underlying implementation.
The configuration file has several examples of this type of keyword definition, including ISSUE.PRIORITY and CONTACT.CONTACT_TYPE. If you need to define additional keywords (for example, to allow Text API access to fields that you have added when customizing your database schema), you can use one of the following predefined methods:
Method |
Output Type |
---|---|
lookup_actbool |
INTEGER |
lookup_asset_by_name |
UUID |
lookup_asset_by_persid |
UUID |
lookup_chg_category |
STRING |
lookup_chg_status |
STRING |
lookup_cnt_by_email |
UUID |
lookup_cnt_by_last_first_middle |
UUID |
lookup_cnt_by_logonid |
UUID |
lookup_cnt_by_persid |
UUID |
lookup_cnt_meth |
INTEGER |
lookup_cnt_type |
INTEGER |
lookup_company |
UUID |
lookup_cr_status |
STRING |
lookup_cr_template |
STRING |
lookup_domain |
INTEGER |
lookup_grc |
INTEGER |
lookup_group |
UUID |
lookup_impact |
INTEGER |
lookup_iss_category |
STRING |
lookup_iss_status |
STRING |
lookup_loc |
UUID |
lookup_mfr_model |
UUID |
lookup_nr_family |
INTEGER |
lookup_org |
UUID |
lookup_person_contacting |
INTEGER |
lookup_position |
INTEGER |
lookup_priority |
INTEGER |
lookup_prob_category |
STRING |
lookup_product |
INTEGER |
lookup_resource_status |
INTEGER |
lookup_service_lvl |
STRING |
lookup_severity |
INTEGER |
lookup_state |
INTEGER |
lookup_timezone |
STRING |
lookup_type_of_contact |
INTEGER |
lookup_urgency |
INTEGER |
lookup_workshift |
STRING |
If the value you need to convert is not addressed by any of these predefined methods, you need to write a customized method. The method should take a STRING value as its input and return a value (either INTEGER, STRING or UUID) as its output. Return a value of -1 (or “-1”) to denote that the value cannot be determined and is therefore, not set. For UUID, return a “(uuid) NULL”.
For example, you might develop a method to convert a user ID to a ca_contact table reference. The incoming value, such as Administrator, would be passed to the method, and the method would return the ca_contact table id for the user ID of Administrator.
The manner in which you define keywords in the configuration file offers you the advantage of defining multiple keyword mappings to the same field, including different conversion methods, depending on the value being specified. For example, assignee can have several different keyword mappings to define how to set its value based on different input values. One input might be user ID, another might be last name, first name, middle name, and still another might be the actual ca_contact id (for example, 793ED69B4E87A545BD8E911834D829FC). Each keyword maps to a different conversion method, except the last one, which does not need to be converted.
Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |