Reltio Connect

 View Only
  • 1.  How can we show a custom message in the UI on approval of any workflow task

    This message was posted by a user wishing to remain anonymous
    Posted 11-19-2024 01:33
    This message was posted by a user wishing to remain anonymous

    In a workflow task for an entity I want to throw a custom message in the UI whenever the task is approved.

    In the workflow action dropdown the assignee will have 2 options - 'Approve' and 'Reject'. On clicking the 'Approve' I want to show some custom message in the UI to the assignee. Can we achieve this in the custom workflow ? Any help will be appreciated.



  • 2.  RE: How can we show a custom message in the UI on approval of any workflow task

    Reltio Employee
    Posted 11-21-2024 04:58

    Hi,

    AFAIR this is not possible currently, but if you can share your use case I can probably guide you on how to achieve something similar.



    ------------------------------
    Thanks,
    Snehil Kamal
    Senior Solution Architect
    Reltio
    Bangalore
    ------------------------------



  • 3.  RE: How can we show a custom message in the UI on approval of any workflow task

    This message was posted by a user wishing to remain anonymous
    Posted 12-02-2024 00:50
    This message was posted by a user wishing to remain anonymous

    Hi Snehil,

    We have custom workflow (not DCR) where a user task has 2 options Approve and Reject. Now if the assignee Approves the task then we need to validate if certain field are populated or not (attribute at the entity level). If the attribute is not populated then the workflow should not proceed to the next step and an error message (custom message) needs to be shown in the UI providing the reason as to why the workflow has not proceeded to the next step.

    Now we are not finding any way forward to show this custom message from the validation task. Please suggest what is the recommended approach to show a message in the UI from the workflow service task.

    Thanks.




  • 4.  RE: How can we show a custom message in the UI on approval of any workflow task

    Reltio Employee
    Posted 12-18-2024 10:17

    hello

    you can customize your business process in the following way:

    • implement your custom WorkflowAction and attach it to a service task right after the user's task;
    • the service task throws an exception if the action was executed without having proper justification (no comments, missing entity attribute, etc).

    The snippet for a custom WorkflowAction

    import com.reltio.workflow.api.WorkflowService;
    import com.reltio.workflow.api.actions.Execution;
    import com.reltio.workflow.api.actions.WorkflowAction;
    import com.reltio.workflow.api.processes.Comment;
    import com.reltio.workflow.api.processes.ProcessesService;
    import com.reltio.workflow.api.rest.ReltioException;
    
    import java.util.List;
    
    public class ApplyAction implements WorkflowAction {
    
        @WorkflowService
        ProcessesService processesService;
    
        @Override
        public void execute(Execution execution) throws ReltioException {
            List<Comment> comments = processesService.getComments(execution.getId());
            // do not allow execute action if there are no comments posted for the process
            if (comments.isEmpty()) {
                throw new ReltioException("{\"responseCode\":400,\"errorMessage\":\"Apply action cannot be executed on a task without comments\"}");
            }
        }
    }

    And map this class to a service task

    Then if there was Approve action executed on the DCR Review users' task and execution comes to this service task the following error will be displayed in Inbox:



    ------------------------------
    Yury Timofeev
    Product Owner of the Workflow
    Reltio
    ------------------------------