Creating Multiple Tasks In One Go

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Triggerz
    Senior Member
    • May 2024
    • 107

    #1

    Creating Multiple Tasks In One Go

    Hi,

    I wanted to create a button that will invoke a modal form that will allow me to create multiple tasks in a table format.
    is this possible to achieve in EspoCRM?

    Thanks & Regards...
  • victor
    Active Community Member
    • Aug 2022
    • 952

    #2
    I don't quite understand your request.
    Please describe it in more detail or provide an example of similar functionality.

    Comment

    • Triggerz
      Senior Member
      • May 2024
      • 107

      #3
      Hi Victor,

      In our company, when we update an Opportunity into a certain status, we create 5 Tasks that will be assigned to 5 different departments/users.
      Instead of manually creating the tasks one by one, I am looking for a way to automate it, like clicking a Generate Task button that will create all 5 tasks automatically.

      Thanks

      Comment

      • lazovic
        Super Moderator
        • Jan 2022
        • 1109

        #4
        Hi Triggerz,

        You can use the workflow with the manual trigger type and the Execute Formula Script action:
        Code:
        $oppId = workflow\targetEntity\attribute('id');
        
        $taskName = 'Task Name';
        $usersIds = list(
            '664eebcb54ff1202f',
            '664eebf3880883792',
            '52eb6b7c2a118',
            '52bd6193938c5',
            '65ccae48919863538');
        
        $tasksCount = 5;
        $i = 0;
        
        while ($i < $tasksCount) {
        
            record\create(
                'Task',
                'name', $taskName,
                'assignedUserId', array\at($usersIds, $i),
                'parentId', $oppId,
                'parentType', 'Opportunity'
                );
                
            $i = $i + 1;
        }
        Last edited by lazovic; Yesterday, 07:59 AM.

        Comment

        • Triggerz
          Senior Member
          • May 2024
          • 107

          #5
          Thanks lazovic, Can you also guide me on how I can create a button to trigger the workflow?

          Comment

          • lazovic
            Super Moderator
            • Jan 2022
            • 1109

            #6
            Triggerz,

            Kindly ask you to note that workflows is the Advanced Pack extension feature: https://www.espocrm.com/extensions/advanced-pack.

            Workflow should look like this:

            Click image for larger version

Name:	image.png
Views:	9
Size:	51.3 KB
ID:	119463
            Click image for larger version

Name:	image.png
Views:	9
Size:	46.9 KB
ID:	119464

            You will find the "Generate Tasks" button in the Opportunity record in the upper right corner.​

            Comment

            • Triggerz
              Senior Member
              • May 2024
              • 107

              #7
              Hi lazovic, I found out that the button can be set in the Advance Pack when creating workflows. Thanks

              Comment

              • Triggerz
                Senior Member
                • May 2024
                • 107

                #8
                Originally posted by lazovic
                Triggerz,

                Kindly ask you to note that workflows is the Advanced Pack extension feature: https://www.espocrm.com/extensions/advanced-pack.

                Workflow should look like this:

                Click image for larger version

Name:	image.png
Views:	9
Size:	51.3 KB
ID:	119463
                Click image for larger version

Name:	image.png
Views:	9
Size:	46.9 KB
ID:	119464

                You will find the "Generate Tasks" button in the Opportunity record in the upper right corner.
                lazovic thank you so much

                Comment

                Working...