Extending Advanced Workflow - Customizing actions

Hello,

Accordingly to Sugar 7.8 Technical Overview, I am trying to extend the advanced workflow by followingthe exemple given (Capitallize action ).

The goal is to capitallize every fields of the bean given.

I created 3 files :
My JSGrouping located in : custom\Extension\application\Ext\JSGroupings\capitalize_action.php
My custom action definition call in : custom\include\javascript\psme\capitalize_action.js
And my custom action class located here : custom\modules\pmse_Inbox\engine\PMSEElements\CustomPMSECapitalizeName.php

I did a quick create and rebuild and I repaired Javascript and JS Groupings.

I also reloaded the entire page but I can't see my customized action in PMSE.

Did I forget anything ?

Many thanks,
Regards,
Bastien.

4370._CustomPMSECapitalizeName.php.txt.zip

8272._capitalize_action.js.txt.zip

8446._capitalize_action.php.txt.zip

  • HI Bastien,

    Correct me if I am wrong, but are you trying to turn to upper case all the values in the text / varchar fields for the given object bean that is being triggered in the workflow?

    If you find that you can't do this in Advanced Workflow (which is probably the case), let us know. We will create for you a custom script that you can use in SierraCRM's Process Manager that will do exactly what your trying to do. 

    Thanks,

    Bill Convis

    SierraCRM, Inc.

  • Hello Bill,

    I was just trying to follow the guide SugarCRM gave us for the 7.8 release (Technical Overview).
    Inside this guide, they create a workflow's action (capitallize record name).

    I followed it and I had no results so I would like to know if someone had troubles too

  • Create these file to make it work. I have tested it on SugarCRM v 7.8.

    custom/include/javascript/pmse/capitalize_action.js

    AdamActivity.prototype.customContextMenuActions = function() {
        return [{
            name: 'CAPITALIZE_NAME',
            text: 'Capitalize Record Name'
        }]
    };

    AdamActivity.prototype.customGetAction = function(type, w) {
        switch (type) {
            case 'CAPITALIZE_NAME':
                var actionText = 'Capitalize the Record Name (Action)';
                var actionCSS = 'adam-menu-icon-configure';
                var disabled = false;
                return {
                    actionText: actionText,
                    actionCSS: actionCSS,
                    disabled: disabled
                }
        }
    };

    custom/Extension/application/Ext/JSGroupings/capitalize_action.php

    <?php

    foreach ($js_groupings as $key => $groupings)
    {
        foreach  ($groupings as $file => $target)
        {
             //if the target grouping is found
            if ($target == 'include/javascript/pmse.designer.min.js')
            {
                //append the custom JavaScript file
                $js_groupings[$key]['custom/include/javascript/pmse/capitalize_action.js'] = 'include/javascript/pmse.designer.min.js';
            }
            break;
        }
    }

    custom/modules/pmse_Inbox/engine/PMSEElements/CustomPMSECapitalizeName.php

    <?php

    require_once 'modules/pmse_Inbox/engine/PMSEElements/PMSEElement.php';

    /**
    *
    */

    class CustomPMSECapitalizeName extends PMSEElement implements PMSERunnable
    {
        
         public function run($flowData, $bean=null, $externalAction = '', $arguments = array())
         {
              $this->capitalizeName($bean);
              $flowAction = $externalAction === 'RESUME_EXECUTION' ? 'UPDATE' : 'CREATE';
              return $this->prepareResponse($flowData, 'ROUTE', $flowAction);
         }

         public function capitalizeName($bean)
         {
                    //Change the field name according to your module
              $bean->name = strtoupper($bean->name);
              $bean->save();
         }
    }

    After creating these files perform these steps:

    1. Quick Repair and Rebuild
    2. Rebuild JS Grouping Files

    Refresh process definition designer page and you will see Capitalize Record Name Action.

  • Hi Altaf Ur Rehman,

    I applied method you suggested. It worked fine. But I want to write two different custom methods. Below is observation if we write two different methods.

    Let's consider, Method 1 is already implemented and working fine and we can see Method 1 in Advanced Workflow Action tool. I created Method 2 using same method as suggested above. Now in Advanced Workflow Action tool, Method 1 option is not available. If we select Method 2 for action, Method 1 is executed. 

    Do you have any idea about how to add two different custom actions for Advanced Workflow?