AnsweredAssumed Answered

Update relationship fields after altering relationship id

Question asked by Carlos Conti Zalacaín on Oct 25, 2016

Hi there,

 

I am trying to open an opportunity editview with prepopulated values for two relationship fields (Offer,Demand). I am being able to change the relationship values but only after refreshing the page, which means the change is done effectively however not in the fields related to the relationship fields present in the Opportunity bean.

 

I have tried the following methods from SugarBean with no luck;

 

$this->bean->setupCustomFields("Offer");
$this->bean->fill_in_relationship_fields();
$this->bean->save_relationship_changes(true);

 

In orther to change the relationship value I use the following procedure:

 

$this->bean->load_relationship("ofrta_oferta_opportunities_1"); /*the relationshipname is valid, have changed the module name for clarity purposes*/

$id2 = '61ecb3ba-3202-8a26-2f64-57e123b78514';
$this->bean->ofrta_oferta_opportunities_1->add(array($id2));

 

And as said the relationship updates successfully but only after reloading the page. Any ideas are very wellcome.

 

Many thanks in advance,

Carlos.

Outcomes