AnsweredAssumed Answered

How to change a field value in view.detail.php?

Question asked by Brad Foster on Nov 11, 2016
Latest reply on Nov 13, 2016 by Offshore Evolution

I've created a custom controller for the BWC campaign module in sugarcrm 7.6 and i'm trying to set a value in a multiselect field on th record detail view.  See my code example below

custom/modules/Campaigns/views/view.detail.php

<?php
require_once('include/json_config.php');
require_once('include/MVC/View/views/view.detail.php');
require_once('modules/Campaigns/views/view.detail.php');

class CustomCampaignsViewDetail extends CampaignsViewDetail
{
    public function CampaignsViewDetail()
    {
        parent::CampaignsViewDetail();
    }

    public function preDisplay()
    {
        parent::preDisplay();
    }

    public function display()
   {

      $this->bean->text_field = "new value" //works great for text fields
      $this->bean->multiselect_field = "new value"; //doesn't work
      $this->bean->multiselect_field = "^new value^"; //doesn't work
      $this->bean->multiselect_field = array("new_value"); //doesn't work
      parent::display();
      echo '<script type="text/javascript" src="custom/modules/Campaigns/custom.js?v' . time() . '"></script>';
   }
}

Outcomes