Hi, We are on Appian Cloud 7.6. I have following requirement:

Hi,
We are on Appian Cloud 7.6.

I have following requirement:

In our current portal version of task form, we have set up a hidden field, which will send an API call to our database with the task information as soon as user accepts the task. That was possible because task form in portal wasn't refreshing on moving between the components.

Now, we are on process of migrating to Tempo, and we want to create the same scenario in the Tempo. So, whenever user accepts the task, then and only in that case API call should be made. I tried following things:

(1) Having the API call in the load(). But that call will be made as soon as the form will be load, not after user accepts the task.
(2) Had a dummy task before the actual task, both of them are activity chained. So, whenever the actual task loads that API call is made. But, this is actually not preferred by our users and conflicts with our business need.

So, is there a way I can achieve the above mentioned...

OriginalPostID-125111

OriginalPostID-125111

  Discussion posts and replies are publicly visible

  • ... functionality (API call during Task Acceptance)?

    Let me know if there is any question!

    Thanks!
  • Take a look at the Task Smart Services Plug-in:
    forum.appian.com/.../summary

    You might be able to use the getTaskAcceptedTimestamp() function in a separate flow. If it is null, then you know the task has not been accepted. If it has a value, then you can make the API call.
  • Thanks all for the response.

    Aleksi,
    What I tried in the process model that, I have added a rule node which will flow if, not(isnull(gettaskacceptedtimestamp(pv!TaskIDFromRule3))) is true. Where pv!TaskIDFromRule3 = getactivetaskidsforprocess(pp!id). But, somehow the flow is not moving ahead even after I accept a task. (Note: The flow the task resides on, and the rule's flow is different, but they are in the same process model.

    Do I need to put the timestamp value in the process variable in order to use the not(isnull()) duo?

    Or am I implementing it in a wrong way?
  • getactivetaskidsforprocess() will return an integer array, but gettaskacceptedtimestamp() accepts a single integer. This might be the issue. Try using the index() function to get the first index from getactivetaskidsforprocess(pp!id), and then pass that into gettaskacceptedtimestamp()
  • Aleksi, I tried that but it didn't flow ahead. But what I noticed that, after accepting task, when I restarted the rule node, it did flow ahead.

    From documentation, what I understood was in case of conditions, the rule node will reevaluate every time process variable's value is changed. I am not sure what happens in case of expressions. Do we have to restart the node to reevaluate the rule node in case of expressions?
  • When testing using gettaskacceptedtimestamp() I got a lot of empty results for a task that was automatically assigned to me. You might need to use gettaskassignedtimestamp() instead if these are tasks that are automatically assigned to users, rather than ones that they have to accept
  • Hi Aleksi,

    Sorry, I might not be understanding it correctly. Following is what I have set up in the process model to test.

    I have two flows flowing from the Start Event. One is going to the User Task Form, and the other is going to the Rule node. Now,
    (1) I have scheduled the Task Form such that it will start only after 2 minutes.
    (2) And the Rule node has the expression count(getactivetaskidsforprocess(pp!id)) > 0; means, as soon as there is an Active (Assigned and/or Accepted) task, the flow will continue.

    So, when I start the process for debugging, the flow will be at Rule node and User Task Form. It won't flow ahead, because there won't be any active task available.

    Now, after two minutes, when the User Task is initiated (activated/assigned), the Rule's expression should evaluate to true, right? In this case, what happens is, the flow from the Rule node is not flowing ahead. It won't flow ahead until and unless I restart that node. So, my question is, is this an actual expected behavior? And if so, how can I set up a way so that the flow would continue as soon as the expression is true.

    Thanks again Aleksi for being patient.
  • Could you explain the use case for having the task wait 2 minutes to start? What is the reasoning behind that?
    What's likely happening is that the rule node is going ahead and evaluating. Since there is not active task yet, it's evaluating to false, and not continuing the flow. Once the task starts and you restart the rule node, it evaluates to true and the flow continues.
    I would recommend one of two things:

    1) If the 2 minute delay isn't necessary, then remove it so the rule node can execute properly and continue the flow

    2) If you do need to the 2 minute timer, then I would add another similar timer in front of the rule node. This way the rule node will only execute (and be able to continue the flow) once the task node has started and been assigned
  • My use case is the original which I mentioned at first. I want to fire an API call as soon as user accepts the task. (We already have a function set up, so I just have to call it when user accepts the task.)

    I was just trying to follow what you suggested, use of gettaskacceptedtimestamp(). Now, I thought I would be able to achieve that using Rule node. And to recreate the scenario in test model, I used two minutes delay. As there is no way to know when user will accept any particular task. I was under impression that the rule will flow as soon as the expression evaluates true (Any time). But, it seems I was wrong.

    So, what shall I do now, in order to achieve my use case. Can you give me any pointers? Or how I should use the gettaskacceptedtimestamp()?

    Thanks again!