How to deducted a value for a task

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ivan2805
    Junior Member
    • Jul 2022
    • 24

    How to deducted a value for a task

    Hi there,

    At the moment we have a target of task being perform for a leads, let say that target is 10 task, so the sales team must perform 10 task for a specific leads.

    For that I'm creating a balance field in the leads entity with 10 as the value.

    The question is, how can I deducted that value to minus 1, everytime a task has been completed for that leads.

    I'm trying to achieve this using formula.

    Any help would be very appreciated.

    Thank you
  • ivan2805
    Junior Member
    • Jul 2022
    • 24

    #2
    Bump...!! Anyone please?

    Comment

    • rabii
      Active Community Member
      • Jun 2016
      • 1250

      #3
      you can try this formula on your task entity:

      Code:
      ifThen(entity\attribute('parentType') == "Lead" && entity\isAttributeChanged('status') && entity\attribute('status') == "Completed",
      $tasksCount = record\attribute('Lead', 'parentId', 'taskCount');
      $newTaskCount = $taskCount - 1;
      record\update('Lead', 'parentId', 'taskCount', $newTaskCount);
      )
      replace taskCount with the field you set on your lead that hols the count.
      i have not tested this so you need to test it but it should work
      Rabii
      Web Dev

      Comment

      • ivan2805
        Junior Member
        • Jul 2022
        • 24

        #4
        Hi rabii

        I've tried the code above but unfortunately its not working, no error code or nothing, it's not deducting the value.

        Comment

        • ivan2805
          Junior Member
          • Jul 2022
          • 24

          #5
          Hi Rabii

          No worries, i manage to figire it out, it turns out the $taskcount variabel from your code is missing an 'S' so i just add the S on it and it works, thank you so much for your help

          Comment

          • rabii
            Active Community Member
            • Jun 2016
            • 1250

            #6
            yes i just noticed that it was missing an S. i am glad it worked now happy that i helped.

            thanks
            Rabii
            Web Dev

            Comment

            Working...