Display accept only when the user has made some modifications.

Display accept only when the user has made some modifications.

book

Article ID: KB0073978

calendar_today

Updated On:

Products Versions
TIBCO EBX All supported versions.

Description

By default, when a user task uses the default service (access data), the Accept button is automatically displayed.
This article we will explain how to modify this behaviour by displaying the accept button only when the user has made some modifications.

Issue/Introduction

In a workflow user task, display accept only when the user has made some modifications.

Resolution

Disable Accept at start

First of all you have to disable the automatic display of the Accept button.
For this you have to set 'true' in the Disable Accept at start input parameter of the user task:

User-added image

Trigger implementation

Now that we are in charge of completing the interaction programatically, we choose to implement the handleAfterModify method of a TableTrigger to do so.

DisplayAcceptTrigger.java
public void handleAfterModify(AfterModifyOccurrenceContext context) throws OperationException {
         
        Session session = context.getSession();
        SessionInteraction interaction = session.getInteraction(false);
         
        if (interaction == null// if not in a workflow context, we do nothing
            return;
         
        interaction.complete(null); // display accept
                         
    }


Now, the accept button will be displayed as soon as a modification is made on a record.

This is a very simple trigger example, and you will of course have to adapt it to your project needs.

Additional Information

https://docs.tibco.com/pub/ebx/5.9.7/doc/html/en/Java_API/com/orchestranetworks/schema/trigger/TableTrigger.html#handleAfterModify-com.orchestranetworks.schema.trigger.AfterModifyOccurrenceContext-
https://docs.tibco.com/pub/ebx/5.9.7/doc/html/en/Java_API/com/orchestranetworks/interactions/SessionInteraction.html#complete-com.orchestranetworks.interactions.InteractionHelper.ParametersMap-