How to make customised multi-line fields preserve carriage returns in maileater and pdm_text_cmd?

Document ID : KB000027425
Last Modified Date : 14/02/2018
Show Technical Document Details

Description

Assume that a customised field, similar to the "Description" field, has been added to the Call_Request database table. Further the field has been added to the text_api.cfg file in the [KEYWORDS] section, so that we can use this field with the "pdm_text_cmd -f" command or via maileater.

As an example to demonstrate the problem, if "pdm_text_cmd -f " or maileater is used to create tickets, assume the following input looks as follows:

%DESCRIPTION=aaa
bbb
ccc
%TYPE=I
%ASSIGNEE=joe.bloggs
%SUMMARY=zzzzzzzzzz
%MY_FIELD=First line
Second line
Third line

Note: In the above example '%MY_FIELD' represents the added customized field

Once the Request is logged it will be seen that:

    1. The 'Description' field data contains the following:

      DESCRIPTION
      aaa
      bbb
      ccc

      Note: The linefeed as entered in the original input is preserved

 

  1. The data associated with the '%MY_FIELD' field contains:

    First line Second line Third line

    Note: The new field isn't treated the same way as the "Description" field, in that all of the carriage returns have been converted to spaces.

Solution

The rule is that all values for the Text API are truncated at the first line feed; or carriage return/line feed for windows.

 

Exceptions to this rule can be found in the [OPTIONS] section of the text_api.cfg file with the LINEFEEDS_ALLOWED option. This option lists all the keywords that are allowed to have line feeds embedded in the data. For these exceptions, the Text API will continue to read the value including line feeds until the end of file or the next % in column 1 is detected denoting a keyword.

 

Out of the box, the default is:

 

LINEFEEDS_ALLOWED= REQUEST.DESCRIPTION, CHANGE.DESCRIPTION,
ISSUE.DESCRIPTION, REQUEST.LOG, CHANGE.LOG, ISSUE.LOG, ASSET.LOG

To make your customized fields act in the same way, add them into this line in the text_api.cfg file:

 

LINEFEEDS_ALLOWED= REQUEST.DESCRIPTION, CHANGE.DESCRIPTION, ISSUE.DESCRIPTION, REQUEST.LOG, CHANGE.LOG, ISSUE.LOG, ASSET.LOG, REQUEST.MY_FIELD

 

Note: This setting must all be on one line, and the fields must be separated by commas.

 

You will need to restart the CA Service Desk services for the change to be effected.