Announcement

Collapse
No announcement yet.

User Task Assignment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • User Task Assignment

    I am using the attached diagram. I need to assign the 'Create OCE?' user task to the person who either created or modified the project. Nothing I've tried has worked so far except assigning specifically to a user, which I don't want.

    I want to figure out how to use these options:

    * User Assigned to Process
    * Related: Created By
    * Related: Modified By

    Created By and Modified By should somehow be related to the Project that triggered the flow, right? Neither option is valid. The User Task is created in the Process User Tasks tab, but there is no assigned user. Any tips would be greatly appreciated.

  • #2
    Created By worked with a new entity, but it does not work when the entity is modified because the Modified By user may be different and the task still goes to the Created By user. I basically need to somehow take the newest of Created By or Modified by unless I need to add more entry points into the flow. I would also like to understand what User Assigned To Process means and how to use it.

    Comment


    • #3
      For now, I got around this by adding a task to the process immediately after the start block that updates the modified user ID and name if the entity is new:

      Code:
      ifThenElse(
          entity\isNew(),
          entity\setAttribute('modifiedById', entity\attribute('createdById'));
          entity\setAttribute('modifiedByName', entity\attribute('createdByName'));
      );
      This works, but it's a hack. It would be nice if there was a cleaner solution.

      Comment


      • #4
        User Assigned To Process is an assigned user of a process record.

        Using formula is the best solution. You can store a user ID in a $variable and then use it further in the flow.

        Comment


        • #5
          I'm not sure if I understand how to use this feature. This is what I'm trying now:

          In the formula section of the start block, I put this code:

          Code:
          ifThenElse(
              entity\isNew(),
              
              $userId = entity\attribute('createdById'));
              $userName = entity\attribute('createdByName'));,
              
              $userId = entity\attribute('modifiedById'));
              $userName = entity\attribute('modifiedByName'));
          );
          There's nowhere to use the variables in the User Task, though. The options are None, User assigned to process, Specified User, Round-Robin, Least-Busy, and then many options related to the project such as Related: Created By. How would I use $userId and $userName?

          Comment


          • #6
            I mean that later on you will be able to use this variable anywhere where formula is available. You can use Update Created Record action to update Process User Task record created in flow before.
            Last edited by yuri; 07-18-2018, 08:38 PM.

            Comment


            • #7
              I'm trying to use the process assignment feature, but it isn't working. The process needs to be assigned to the person who created the entity if it's new or the person who modified it if it's not new.

              This is the flowchart:

              Click image for larger version

Name:	2018-08-11_09-11-14.png
Views:	461
Size:	25.0 KB
ID:	41390


              Project Created/Saved details:

              Click image for larger version

Name:	2018-08-11_09-11-35.png
Views:	388
Size:	24.4 KB
ID:	41391


              Process assignment task details (this is what doesn't work):

              Click image for larger version

Name:	2018-08-11_09-11-50.png
Views:	391
Size:	23.9 KB
ID:	41392


              "Create OCE?" process user task details:

              Click image for larger version

Name:	2018-08-11_09-11-58.png
Views:	364
Size:	15.8 KB
ID:	41393


              If I force the Assigned User of a process to be a specific person, everything works fine. With the following formula in the Assign Process task, it does not work as expected. The value of Assigned User in the process is empty/null.

              Code:
              ifThenElse(
                  entity\isNew(),
                  assignedUserId   = entity\attribute('createdById');
                  assignedUserName = entity\attribute('createdByName');,
                  assignedUserId   = entity\attribute('modifiedById');
                  assignedUserName = entity\attribute('modifiedByName');
              );

              Here's the log:

              Code:
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: Start workflow [afterRecordSaved] for Entity [Project, 5b6efc2ad205f11c6]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: Start workflow rule [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: Condition result [1] for workflow rule [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: Start running Actions for workflow rule [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: Workflow\ActionManager: Start workflow rule ID [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: Workflow\Actions: Start [startBpmnProcess] with cid [0] for entity [Project, 5b6efc2ad205f11c6]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: BPM: startProcess, flowchart 5b4e7c85b2ebbcad1, target 5b6efc2ad205f11c6 [] []
              [2018-08-11 15:09:31] Espo.DEBUG: BPM: prepareFlow, process 5b6efc2b7e2e3de40, element 4bxiur823e [] []
              [2018-08-11 15:09:31] Espo.DEBUG: BPM: prepareFlow, process 5b6efc2b7e2e3de40, element nw1usizwei [] []
              [2018-08-11 15:09:31] Espo.DEBUG: Workflow\Actions: Start [updateProcessEntity] with cid [0] for entity [Project, 5b6efc2ad205f11c6]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: Workflow\Actions: End [updateProcessEntity] with cid [0] for entity [Project, 5b6efc2ad205f11c6]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: BPM: prepareFlow, process 5b6efc2b7e2e3de40, element bpbxt7ys7u [] []
              [2018-08-11 15:09:31] Espo.DEBUG: Workflow\Actions: End [startBpmnProcess] with cid [0] for entity [Project, 5b6efc2ad205f11c6]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: Workflow\ActionManager: End workflow rule ID [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: End running Actions for workflow rule [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: End workflow rule [5b6efabe4b4b7b8c8]. [] []
              [2018-08-11 15:09:31] Espo.DEBUG: WorkflowManager: End workflow [afterRecordSaved] for Entity [Project, 5b6efc2ad205f11c6]. [] []

              What can I do to update the assigned user of the process using the logic in my formula?

              Comment


              • #8
                Bump... any help would be greatly appreciated. Some of the entities on my site don't need an assigned user, which is the root if this problem. I think one way to solve this would be to have a function that uses whichever field is newer - created by or modified by. I'm not sure if I know how to make that work, though.

                Comment

                Working...
                X