Return custom error message from attached process in Cognos TM1 Application

Instruction how to return custom error message to Cognos TM1 Application user from attached process

TI process can be terminated using one of these functions:

  • ProcessBreak;
  • ProcessError;
  • ProcessQuit;

Two of them ProcessError and ProcessQuit will terminate process with error message, that will look like this:

1

As you can see, this message does not give any concrete information to the end user, especially if you have multiple conditions that can generate the error in TI code.

In this tutorial I will show you how to customize this message and show popup that looks like this:

2

First of all you need to create new eror code in }tp_process_errors_localization dimension. To do this use this TI template or add element to dimension manually:

sErrorCode = 'CustomErrorCode';
sErrorCodeCaption = 'Custom Error Header';
sErrorType = 'Error';
cDim = '}tp_process_errors_localization';

DimensionElementInsertDirect(cDim, '', sErrorCode, 'N');
AttrPutS('en', cDim, sErrorCode, 'CaptionDefaultLocale');
AttrPutS(sErrorCodeCaption, cDim, sErrorCode, 'Caption');
AttrPutS(sErrorType, cDim, sErrorCode, 'ErrorType');

Change:

  • sErrorCode - principal name of the error code, that will be used later, when you will execute process to show message;
  • sErrorCodeCaption - user friendly name of the message, that will be displayed at the popup before semicolon;
  • sErrorType - could be 'error' or 'warning'. Choose any.

After this step restart Cognos Application service, as sometimes it will not recognise new error codes and will show you message, that will contain only error code, without description:

3

Now you can modify process that is assigned to Applications Commit or Submit actions. Add this code before ProcessQuit or ProcessError functions. Write your message to pErrorDetails parameter.

ExecuteProcess('}tp_error_update_error_cube', 
  'pGuid', pExecutionId, 
  'pProcess', GetProcessName(),
  'pErrorCode', 'CustomErrorCode',
  'pErrorDetails', 'Custom message, that will help user to correct data',
  'pControl', 'Y');

Now Cognos must show you error message with yours description.

If you need to delete your custom error code, delete it with DimensionElementDeleteDirect and restart Cognos Application service.

sErrorCode = 'CustomErrorCode';
DimensionElementDeleteDirect('}tp_process_errors_localization', sErrorCode);

Also you can read about this Cognos feature in official IBM documentation.