AnsweredAssumed Answered

Dependency triggerfields

Question asked by Neil Conacher on Nov 5, 2019
Latest reply on Nov 7, 2019 by Neil Conacher

I have been working with dependency files for some of the functionality (SetOptions, SetRequired, SetValues etc) and generally very useful.

 

However a couple of questions:

 

1) Conditional logic : trigger or action value

 

Depending on the circumstance, I can get dependencies to work putting the logic into either the trigger or the action value. The documentation isn't fully clear on this. Is there a 'best practice' or does it depend on the type of dependency/action being used

 

2) Trigger when creating a new record only works on initial entry, not when a trigger field changed during entry

 

So with example below, if I create a new Opportunity (just setting up, not Saving) I get the following behaviour:

 

Create > set Sales Stage to something other than 'Closed Won', target field not 'Required' = good result

 

Create > set Sales Stage to 'Closed Won', target field 'Required' = good result

 

Create > set Sales Stage to 'Closed Won', target field 'Required' > change Sales Stage to something other than 'Closed Won', target field remains 'Required' = not good result

 

In other words, the watch trigger does not seem to kick in when changes made to the triggerfield(s) during record edit

 

$dependencies['Opportunities']['required_dep_prthrs'] = array(
'hooks' => array("edit", "view"),
'trigger' => 'isInList($sales_stage, createList("Closed Won"))',
'triggerFields' => array('sales_stage'),
'onload' => true,
//Actions is a list of actions to fire when the trigger is true
'actions' => array(
array(
'name' => 'SetRequired',
//The parameters passed in will depend on the action type set in 'name'
'params' => array(
'target' => 'sym_partner_hours_c',
'value' => 'true',
),
),
),
);

 

 

Thanks

 

Neil

Outcomes