Skip to content

Instantly share code, notes, and snippets.

@jwhitcraft
Created January 26, 2012 13:14
Show Gist options
  • Save jwhitcraft/1682698 to your computer and use it in GitHub Desktop.
Save jwhitcraft/1682698 to your computer and use it in GitHub Desktop.
<?php
/**
* Make the primary address postalcode required when the status is "qualified"
* and the region_c equals to "Europe", "Middle East", "Africa"
*
*/
$dependencies['Leads']['primary_address_postalcode'] = array(
'hooks' => array("edit"), // this is when you want it to fire, since it's only on edit view we just have edit
'trigger' => 'true', // to fire when fields change
'triggerFields' => array('status', 'region_c'), // which fields to fire on when they change
'onload' => true, // fire when page is loaded
'actions' => array( // actions we want to run, you can have multiple actions here
array(
'name' => 'SetRequired', // we want to make the postal code required
'params' => array( // the params for the method
'target' => 'primary_address_postalcode', // the field id
'label' => 'primary_address_postalcode_label', // the field label id
'value' => 'and(equal($status, "Qualified"), isInList($region_c, createList("Europe","Middle East","Africa")))', // the SugarLogic for it to tigger if the field is required or not
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment