<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Calculated Fields not updating on $bean-&amp;gt;save()</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/5174/calculated-fields-not-updating-on-bean--save</link><description>Hi all. 
 
 I&amp;#39;ve been racking my brain on this one now, I tried $bean-&amp;gt;updateCalculatedFields(); but it&amp;#39;s not working. Currently I am filling in missing records, so I am creating: Lead -&amp;gt; Contact/Account -&amp;gt; Opportunity -&amp;gt; Meeting, they all have a &amp;quot;unique</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Calculated Fields not updating on $bean-&gt;save()</title><link>https://sugarclub.sugarcrm.com/thread/25043?ContentTypeID=1</link><pubDate>Thu, 07 Oct 2021 09:34:32 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:41407033-4fd3-4f13-a910-58297547d818</guid><dc:creator>Laurent Conroux</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Could this come from from the way the links are created?&lt;br /&gt;When we work with new Beans and Relationships we find best to generate the ids before linking the modules and saving:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;$bean-&amp;gt;id = Sugarcrm\Sugarcrm\Util\Uuid::uuid4();
$bean-&amp;gt;new_with_id = true;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I think the reason was that ids are generated after the relationship save in the SugarBean save method.&lt;br /&gt;Or something similar, I may not remember it exactly :).&lt;/p&gt;
&lt;p&gt;Hoping it helps.&lt;br /&gt;Laurent&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculated Fields not updating on $bean-&gt;save()</title><link>https://sugarclub.sugarcrm.com/thread/24998?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 11:03:30 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:44683105-90b2-495e-b537-f43175d586fc</guid><dc:creator>Jeroen Somhorst</dc:creator><description>&lt;p&gt;which version of sugar? And you are talking about an entry point. Is it an custom api? Or and entrypoint using&amp;nbsp;entrypoint registry?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculated Fields not updating on $bean-&gt;save()</title><link>https://sugarclub.sugarcrm.com/thread/24997?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 10:50:04 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9ce8c51c-f960-4a22-9296-feee31b291b6</guid><dc:creator>Daniel Hill</dc:creator><description>&lt;p&gt;Hi Jeroen.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yep I&amp;#39;ve tried that I&amp;#39;m afraid, I am doing it via an entry point so not sure if that conforms to different practices?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculated Fields not updating on $bean-&gt;save()</title><link>https://sugarclub.sugarcrm.com/thread/24996?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 10:34:30 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:f2bd30d8-afa8-42a6-878c-bf263652a170</guid><dc:creator>Jeroen Somhorst</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;to be sure. After the relationhip adds did you put a $contact-&amp;gt;updateCalculatedFields(); $account-&amp;gt;updateCalculatedFields() before you hit save and that didn&amp;#39;t work? Even when you dit it after the current saves on lines 100, 101 and adding &amp;#39;extra&amp;#39; saves?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>