ObjectGears Help

Forum   ObjectGears (Version:

Buttons in WF tasks

Standard screen for workflow task contains a bar with button, in which user confirms task completion. In many cases this means user decision (e.g. approved/rejected, implemented/not implemented). In such cases we add a column of type reference to another class into the class for task recording, mark the column as mandatory and let user select one of values before saving the record.

Functionality description

In these cases we can increase user comfort by replacing standard panel with two buttons with corresponding titles and icons, e.g. Approve and Reject. In case of clicking on Reject and not filling in field Comment, we notify user with a localized message saying that in case of rejection a comment with rejection reason has to be filled in.

Solution description

We create two buttons of type Script in the class containing workflow tasks we. We set for both Display in the detail on toolbar and Display by a record change.

Button Approve

// Set column wf_action to value 1 and save the task

var cApp = OG.Column.GetByCode( OGActualDataRowParentId,  'wf_action');
OGForm.GetControl( cApp.Id).SetData(1);



Button Reject

In the script stated function OG.Messageloc.GetText returns appropriate language option of the message with code reject_task (according to the settings of the current user). Messages can be set under Administration - Localization - Message.

// If column comment is null, return error message reject_task. Otherwise, set column wf_action to value 2 and save the task

var cCom = OG.Column.GetByCode( OGActualDataRowParentId,  'comment');
var com =OGForm.GetControl(cCom.Id).GetData();

if ( !System.String.IsNullOrEmpty(com))
var cApp = OG.Column.GetByCode( OGActualDataRowParentId,  'wf_action');
OGForm.GetControl( cApp.Id).SetData(2);

OGForm.SetError( OG.MessageLoc.GetText( OGModel.Id, 'reject_task'));

Furthermore, we want to hide the standard panel for workflow task completion. We will use following script in the script for the record detail of the class for workflow tasks:

function OnLoad()
    OGDataDetailForm.ShowApproveTaskPanel = false;

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information