Is there a way to 'complete' a task in a lifecycle, programmatically?

Emil_R
edited June 20, 2023 in AppWorks #1

Hi there -

Thanks to everyone who has engaged with my forum posts, it is appreciated. I have one last question as I wrap up an approval workflow for our accounting team.

Is there a way to programmatically 'complete' a task in a lifecycle? The only option I'm able to progress a task forward is by clicking 'complete'

Currently, we have this flow:

  1. User claims a task
  2. User must click approve or reject (which triggers a rule, adjusting a boolean value we read in our BPM, which acts as the 'approval' status i.e. approved = 1, rejected = 0)
  3. User HAS to click complete decision (which is 'Complete' task in the LifeCycle Task)

We could foresee this being a bit confusing for our users, but if it is the only way, we will proceed. This leads me to my question… is there a way to programmatically 'COMPLETE' a task? When I take a look at creating a rule, AppWorks does not allow you to adjust the the task state with a rule.

I have also taken a look into using the 'update' LifecycleTask web service, but I cannot find any documentation nor can I get the web service to work and update the state, so the task is progressed in the BPM.

Ideally when a user clicks APPROVE or REJECT, it would proceed and complete the task. Having a user click " claim—>approve or reject—> complete " seems like it would be a bit confusing and it is a bit frustrating that AppWorks does not let us modify this at all.

Does anyone have any ideas or thoughts? Any help/pointers would be appreciated. Big thanks!

Comments

  • Karen Weir
    Karen Weir E Community Administrator

    Thank you for posting. I have moved your inquiry to our AppWorks category where we have experts participating.

  • Emil_R
    edited June 20, 2023 #4

    EDIT:

    I have also tried the following with the Lifecycle-update web service; it seems to be in the correct format BUT it does not complete the lifecycle step like I'd expect.

    When I invoke:

    Success message (state stays as '2'):

  • Shanti Vardhan
    Shanti Vardhan E Member
    edited June 20, 2023 #5

    @Emil_R

    There is webservice PerformTaskAction where you can do applicable actions on tasks such as start, skip, complete etc. See below request to complete a task

    The GUID that is to be passed to this webservice is 'ParentTaskId' from ReadLifecycleTask webservice for that entity.

    So, you can create custom Rule action on lifecycletask entity 'Complete' and trigger a BPM that executes above webservice and update the flag to 'Approved'.

    So, the BPM activities would look as below

    Start-ReadLifecyleTask-PerformTaskAction-UpdateLifecycleTask(Status=Approved)-End

  • @Shanti Vardhan this is exactly what i was looking for - thank you so much! worked flawlessly

  • Hi,

    The "PerformTaskAction" service (incl. BPM example) is explained here as well in more detailed:
    https://appworks-tips.com/2021/11/26/118_dynamic_task_handling_in_parallel_flow/

    Grz, Antal

  • I have a lifecycle that uses "User Events" to transition from state to state such as "Approve for Payment" and "Do not Approve" or "Create Case". Each of these tasks are marked as OBSOLETE and PerformTaskAction will not allow me to mark the task as "COMPLETE".

  • Hi,

    Once that task is OBSOLETE, we cannot complete

  • Is there a way to keep the task from being set to OBSOLETE once the User Event is clicked. What's the point of the User Event buttons if we can't complete the task?