DEVELOPERS NEWS

Dynamically assign people to projects

Written by Aristide Zouheir-Kuhnle | Aug 25, 2023 1:55:51 PM

DALIM ES has a very strong workflow engine with several possibilities to map users to tasks.

Approval steps can be approved by individual persons, groups of people or roles (called actors as well). Milestones can be approved by roles only.

This topic here is perfect if:

  • You want to change a person or a group assign to an actor during your workflow, after a validation step
  • You want to add a new actor line in your production list
  • You do not have access to the production list at the project creation level
  • You do not have access to the API to make a step script

Adding an actor to a project is required if you want this person to approved a step assigned to a role but do not forget that you may want to add someone into the stakeholder list just to:

  • Make the project visible to the person (the profile can filter access to projects based on project member)
  • or, to trigger notifications to a person playing a specific role in a project
  • or, to simply have other stakeholder know who is the contact for a specific role.

Ingredients Needed 

 

So, what will you need to achieve this? 

 

  • DALIM ES with one of the following license options which enable the editing of workflows:

    • ES Enterprise Project Tracking (ES-5400)

       

      or

    • ES Workflow Editing (ES-5211)

       

    • ES Custom Job Ticket (ES-5300) to add a custom layout to your approval step.

    • Some basic skills on workflow editing with DALIM ES.

No advanced java scripting is required, just follow the guide below!

 

 

Step by step guide

 

In your workflow, in a programmed link use the function SetProductionGroup. The arguments of this function are the name of your user or group and the actor that will receive the new value. You can get values from MetadataValues. 


    var agency = Context.getMetaData("Job","MdtNameSpace","AgencyContact");   

    var customer Context.getMetaData("Job","MdtNameSpace","CustomerContact");
    
    var array = Java.type("java.lang.Object[]");                                                                   
    
    if(customer != null && customer.length > 0)                                                                
    
     {                                                                                                                                                         
    
              var argsCustomer = new array(3);                                                              
              argsCustomer[0] = "SetProductionGroup";                                          
              argsCustomer[1] = customer;                                                                
              argsCustomer[2] = "CUSTOMER";                                                         
                 Context.exec("JobFunctions", argsCustomer);                                      
    
    }                                                                                                                                         
    
    if(agency != null && agency.length > 0)                                                                       
    
    {                                                                                                                                           
              var argsAgency = new array(3);                                                              
              argsAgency[0] = "SetProductionGroup";                                                
              argsAgency[1] = agency;                                                                          
              argsAgency[2] = "AGENCY";                                                                    
                      Context.exec("JobFunctions", argsAgency);                                                 
    }                                                                                                                                          
    
    return true; 

 

Use case

 

  • Create a metadata set such like MdtNameSpace
  • Inside MdtNameSpace, create two enumeration metadata of type userenumerationItem and name for example AgencyContact and CustomerContact
  • Create a JobticketLayout: project creation (if you want to set the person at job creation) or as approval layout (if you want to add that person during a milestone validation). 
  • Place the two enumeration metadatas with some entries (these entries has to be the same as your user or group)

Custom layout setup:

 

Result:

  • In your project workflow, change one of your link to a programmed link, in javascript. Copy and paste the javascript code seen above into the link editor:

 

  • Your production list will be edited with the new values automatically when the link gets executed. 

  • From this moment onward, without even restarting a workflow step, that new actor will get the permission to approve/reject the steps assigned to the role CUSTOMER or AGENCY.