Default Values for Multi Selects in Dashlets

This took me a bit to figure out, so I thought it was worth a post. I’m not sure where all this applies, but here is where it applied to me.

I created a dashlet for Projects, and I wanted default values for “Status”, but I wanted to select multiple values as default.

Here is how I did it… I’m not entirely sure the ‘type’ => ‘multiselect’ is necessary or even appropriate. This is a snippit from MyProjectsDashlet.data.php.

$dashletData['MyProjectsDashlet']['searchFields'] = array('date_entered'     => array('default' => ''),
     'aa_file_c'    => array('default' => ''),
     'status' => array('default'=>array('Draft','proposal_sent','verbally_accepted','proposal_received','schematic_design','design_development','construction_documents','bid_award','construction_administration','system_commissioning','closeout'),
          'type' => 'multiselect'),
     'assigned_user_id' => array('type'    => 'assigned_user_name', 
          'default' => $current_user->name,
     'label' => 'LBL_ASSIGNED_TO')
);
1 Like

Thank you for sharing sieberta,

Your community contribution is greatly appreciated.

Thanks,

Will.