Question

Multi Select Lookup - Selected values in dynamic task expressions

  • 10 November 2023
  • 3 replies
  • 103 views

Userlevel 3
Badge +8

Im trying to develop a dynamic task expression that pulls through the selected options on a multi select lookup, but Im having difficulty with the expression code. This is the set up for the Multi Select Lookup:

And in the task expression I have tried utilizing following codes: 

$new.parentEvent.W("MSL-BU")
$new.parentEvent.W("MSL-BU").name
$new.parentEvent.W("MSL-BU").shortCode
$new.parentEvent.W("MSL-BU").value
$new.parentEvent.W("MSL-BU").values
$new.parentEvent.W("MSL-BU").multiSelectValues
$new.parentEvent.W("MSL-BU").multiSelectValues.systemLookupValue
$new.parentEvent.W("MSL-BU").multiSelectValues.systemLookupValueId
$new.parentEvent.W("MSL-BU").multiSelectValuesShortCode
$new.parentEvent.W("MSL-BU").multiSelectValues.id
$new.parentEvent.W("MSL-BU").multiSelectValues.shortCode

but the result is always returned as “NO VALUE”. 

I’ve tried trawling through the wiki to no success. Has anyone else managed to do this? 


3 replies

Badge +2

Me and my colleague @Rune Andersland are trying to solve the exact same issue as you. Will let you know if we find a solution.

 

 

Userlevel 2
Badge +7

I was a long time ago given an expression crib sheet from Axios and it included this expression. (I have never used it and I have amended to your shortCode above)

if($new.W("MSL-BU").shortCode = "OPTION1", $NO_VALUE, 
if($new.W("MSL-BU").shortCode = "OPTION2", $NO_VALUE, $NO_VALUE))

 

The below is a working exaple of dynamic task expressions dependent on the value selected from a single-select lookup if that is of any use

if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "TREASURY SYSTEMS","TREASURY SYSTEMS",
if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "TREASURY","TREASURY",
if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "BACK OFFICE","BACK OFFICE",
if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "FINANCE","FINANCE",
if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "TAX","TAX",
if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "INSURANCE","INSURANCE",
if($new.W("BARCLAYS_AMEND ACCES PROFILE_ROLE DEFINITION").shortCode = "Z_OTHER","Z_OTHER",$NO_VALUE )))))))

Userlevel 2
Badge +9

Hi Kevin

The way I have handled this in the past is to 

  1. Create a string field on the form that the other users cannot see
  2. Add a “system” Stage and Task to the process before the stage where you want your dynamic task to trigger
  3. Have associated with the creation of the above Task, a SmartMail job that will gather the values from the multi select values and format them in an array string that looks like as follows
    [“ASSYST”,”ASSYSTNET”,”ASSYSTWEB”,”ASSYSTDB”]
  4. That Smartmail job has an update_event_ejb call that places that string in the aforementioned field you have created. Lets say that field short code is called SYSTEMS

     

    {"update_event_ejb",

       eventId = [[ PARENT_EVENT_ID ]],

     customFields =      [[

                                          {

                                              { customFieldShortCode = "SYSTEMS",

                                              stringValue = ""..ARRAY_STRING

                                              },

                                         }

                                    ]],

    },

  5. It then closes the task moving onto the next stage for which the Dynamic Task expression reads $new.W(“SYSTEMS”).value 

  6. Which for the above example string will produce 4 tasks for each element in that array, i.e. the systems chosen. 

If those values were valid item short codes then they can be substituted into the item A or B fields with the simple $DYNAMIC_TASK_VALUE expression returned for having a dynamic task expression

 

 

Reply