<?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>Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/449/modify-return-data-from-related-field</link><description>Hi, I&amp;#39;m working on Sugar 7.5 Enterprise, i have a relation between accounts and oportunitties and i need to copy a content field from the accounts module and paste into a field in the opportunitties module, but keeping this field editable. In SugarCE</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1460?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 04:52:20 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:994d4f29-50f9-4ca2-be07-2b198a14e7ce</guid><dc:creator>Peter Hallett</dc:creator><description>&lt;p&gt;That was all too simple. Thanks again Francesca.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1459?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2019 13:49:52 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:4737fa26-abf1-4f0a-a95c-d9103f3908fc</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Because you are in the &amp;quot;Create&amp;quot; view clearly this is a new record, otherwise you would be in the &amp;quot;Record&amp;quot; view. This means that ever time your CreateView controller runs it does so for a brand new record.&lt;/p&gt;&lt;p&gt;You could therefore run the Populate my field directly in your initialize for the first time, then repeat it if the account changes (maybe the user got the wrong account at first and wants to change it):&lt;/p&gt;&lt;pre class="language-javascript line-numbers"&gt;&lt;code&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; extendsFrom&lt;span class="punctuation token"&gt;:&lt;/span&gt; &lt;span class="string token"&gt;&amp;#39;RecordView&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; initialize&lt;span class="punctuation token"&gt;:&lt;/span&gt; &lt;span class="keyword token"&gt;function&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;options&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;_super&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;initialize&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="punctuation token"&gt;[&lt;/span&gt;options&lt;span class="punctuation token"&gt;]&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;populateMyField&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;model&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;on&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;change:account_id&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;populateMyField&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; populateMyField&lt;span class="punctuation token"&gt;:&lt;/span&gt; &lt;span class="keyword token"&gt;function&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="keyword token"&gt;do&lt;/span&gt; your thing&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="line-numbers-rows"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The&lt;/p&gt;&lt;pre class="" style="color:#000000;background:#f5f2f0;border:0px;font-size:11pt;margin:0in;padding:1em 1em 1em 3.8em;"&gt;&lt;code style="border:0px;font-weight:inherit;font-size:14.6667px;"&gt;&lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;if&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;&lt;span class="" style="color:#a67f59;background:rgba(255, 255, 255, 0.5);border:0px;font-weight:inherit;font-size:14.6667px;"&gt;!&lt;/span&gt;_&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;.&lt;/span&gt;&lt;span class="" style="color:#d74444;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;isEmpty&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;&lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;this&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;.&lt;/span&gt;model&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;.&lt;/span&gt;&lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;get&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;&lt;span class="" style="color:#669900;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;&amp;#39;account_id&amp;#39;&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt; &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;will prevent the function from running any further if there is no account selected.&lt;/p&gt;&lt;p&gt;Having said that, note that you have a condition:&lt;/p&gt;&lt;pre class="" style="color:#000000;background:#f5f2f0;border:0px;font-size:11pt;margin:0in;padding:1em 1em 1em 3.8em;"&gt;&lt;code style="border:0px;font-weight:inherit;font-size:14.6667px;"&gt;&lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;if&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;_&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;.&lt;/span&gt;&lt;span class="" style="color:#d74444;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;isEmpty&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;&lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;this&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;.&lt;/span&gt;model&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;.&lt;/span&gt;&lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;get&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;&lt;span class="" style="color:#669900;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;&amp;#39;licenseename_c&amp;#39;&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Which means that the function only takes effect once - the first time you set the liceseename.&amp;nbsp;&lt;/p&gt;&lt;p&gt;If the user sets the account, then changes the account (maybe they made a mistake), the licesee name will NOT change to that of the newly set account. I think you should remove that if statement - though I may be missing something in your logic.&lt;/p&gt;&lt;p&gt;You may also consider adding the on change event to your Record View controller in case a user wants to change the Account&amp;nbsp;&lt;em&gt;after&lt;/em&gt; the record was saved. When editing a previously saved record the controller will be the RecordView controller, not the Create controller.&lt;/p&gt;&lt;p&gt;Hope this&amp;nbsp;helps,&lt;/p&gt;&lt;p&gt;FrancescaS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1458?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2019 01:59:19 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:675c3c3c-76ae-495f-9422-3925b392230a</guid><dc:creator>Peter Hallett</dc:creator><description>&lt;p&gt;Hi Francesca,&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks again, the solution you provided above is working well for me now when I create a Contract from scratch.&lt;/p&gt;&lt;p&gt;However when I create a Contract from the Account Screen, or from the Contract Menu, the Account Name is already populated and does not fire the OnChange event, therefore my &amp;quot;licneseename_c&amp;quot; field is not set on the Contract when they are created with this method.&amp;nbsp; (BTW we call call Contracts Agreements.)&lt;/p&gt;&lt;p&gt;&lt;a href="https://community.sugarcrm.com/servlet/JiveServlet/showImage/2-105583-84340/2019-07-29_11-33-38.jpg"&gt;&lt;img alt=" " class="image-1 jive-image j-img-original" height="375" src="https://community.sugarcrm.com/servlet/JiveServlet/downloadImage/2-105583-84340/2019-07-29_11-33-38.jpg" width="1084" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="https://community.sugarcrm.com/servlet/JiveServlet/showImage/2-105583-84341/2019-07-29_11-37-53.jpg"&gt;&lt;img alt=" " class="image-2 jive-image j-img-original" height="82" src="https://community.sugarcrm.com/servlet/JiveServlet/downloadImage/2-105583-84341/2019-07-29_11-37-53.jpg" width="1094" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Do you know if this is a different Event that is fired, e.g. an OnLoad event, or is there a way of detecting where the Contract was created from, e.g. from scratch or form the Account page?&amp;nbsp; As I would like to make sure that my &amp;quot;licenseename_c&amp;quot; field is populated when I create Contracts/Agreements using these methods.&amp;nbsp;&lt;/p&gt;&lt;p&gt;As always, any suggestions would be greatly appreciated.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1457?ContentTypeID=1</link><pubDate>Sun, 21 Jul 2019 09:57:24 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:8c0e921a-96ca-4c20-9571-fc61e0bc95c5</guid><dc:creator>Peter Hallett</dc:creator><description>&lt;p&gt;Thanks Francesca,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#ffffff;"&gt;var self = this;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#ffffff;"&gt;Was what I needed.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1456?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 16:30:21 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:35d9543d-7a11-482c-90d0-ee1d5f9fa616</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Are you copying the Account name from the relate field into a text field called licenseename_c?&lt;/p&gt;&lt;p&gt;Because if that&amp;#39;s the case then you don&amp;#39;t need to go through all that, you should have a hidden field called &amp;#39;account_name&amp;#39; in the model itself.&lt;/p&gt;&lt;p&gt;&lt;span&gt;T&lt;/span&gt;&lt;span&gt;ry console.log(this.model) at the beginning of your method to see where the account name is, I&amp;#39;m pretty sure it&amp;#39;s there.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;So your method could just copy that:&lt;/p&gt;&lt;pre class="" style="color:#000000;background:#f5f2f0;border:0px;font-size:11pt;margin:0in;padding:1em 1em 1em 3.8em;"&gt;&lt;code style="border:0px;font-weight:inherit;font-size:14.6667px;"&gt;populateMyField&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;:&lt;/span&gt; &lt;span class="" style="color:#0077aa;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;function&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;(&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;)&lt;/span&gt;&lt;span class="" style="color:#999999;border:0px;font-weight:inherit;font-size:14.6667px;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&amp;nbsp; if(!_.isEmpty(this.model.get(&amp;#39;account_name&amp;#39;))){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.model.set(&amp;#39;licenseename_c&amp;#39;, this.model.get(&amp;#39;account_name&amp;#39;));&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;If you need to get other fields from Accounts, then you can continue with the method above. I&amp;#39;m thinking I had an error in the code and that inside the xhr the &amp;quot;this&amp;quot; is not what we think it should be, add a&amp;nbsp;&lt;/p&gt;&lt;p&gt;var self = this;&lt;/p&gt;&lt;p&gt;at the beginning of your method and then use self instead of this inside the xhr, that should work.&lt;/p&gt;&lt;p&gt;FrancescaS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1455?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 11:31:57 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:1102b9b4-074f-4ba8-a349-4cff7bc05df3</guid><dc:creator>Peter Hallett</dc:creator><description>&lt;p&gt;Hi Francesca,&lt;/p&gt;&lt;p&gt;The above sample code has been very helpful in solving a similar problem that&amp;nbsp;I have.&lt;/p&gt;&lt;p&gt;I&amp;#39;m using SugarCRM Professional 8.0.3. I have a relationship between my Contracts and Accounts. I want to copy a custom field from and Account (&amp;#39;account_licenseename_c&amp;#39;) to a custom field on the Contract (&amp;#39;licenseename_c&amp;#39;) when the Account is changed on the Contract, then eventually when a new Contract is created.&lt;/p&gt;&lt;p&gt;I have adapted code from the example you provided in this post. However I seem to be receiving an error on the following line:&lt;/p&gt;&lt;pre&gt;this.model.set(&amp;#39;licenseename_c&amp;#39;,accountLicenseeName);&lt;/pre&gt;&lt;p&gt;The error is shown in the Debug window as &amp;quot;Uncaught TypeError: Cannot read property &amp;#39;set&amp;#39; of undefined.&amp;quot; As in the screen shot below.&lt;/p&gt;&lt;p&gt;&lt;a href="https://community.sugarcrm.com/servlet/JiveServlet/showImage/2-105472-84246/2019-07-19_21-03-20.jpg"&gt;&lt;img alt=" " class="image-1 jive-image j-img-original" height="649" src="https://community.sugarcrm.com/servlet/JiveServlet/downloadImage/2-105472-84246/2019-07-19_21-03-20.jpg" width="955" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="margin:0in;font-size:11.0pt;"&gt;My full code is provided.&lt;/p&gt;&lt;pre class="language-javascript line-numbers" style="margin:0in;font-size:11.0pt;"&gt;&lt;code&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; extendsFrom&lt;span class="punctuation token"&gt;:&lt;/span&gt; &lt;span class="string token"&gt;&amp;#39;RecordView&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; initialize&lt;span class="punctuation token"&gt;:&lt;/span&gt; &lt;span class="keyword token"&gt;function&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;options&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;_super&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;initialize&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="punctuation token"&gt;[&lt;/span&gt;options&lt;span class="punctuation token"&gt;]&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;model&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;on&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;change:account_id&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;populateMyField&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; populateMyField&lt;span class="punctuation token"&gt;:&lt;/span&gt; &lt;span class="keyword token"&gt;function&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="comment token"&gt;//if the account field on the Agreement is not empty (we just changed it and it could have been deleted)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;if&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="operator token"&gt;!&lt;/span&gt;_&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;isEmpty&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;model&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="keyword token"&gt;get&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;account_id&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt; &lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="comment token"&gt;//if the field on the Agreement is not already set, you&amp;#39;ll need this more on edit than create not to override prior values&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;var&lt;/span&gt; newAcccountID &lt;span class="operator token"&gt;=&lt;/span&gt; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;model&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="keyword token"&gt;get&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;account_id&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;if&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;_&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;isEmpty&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;model&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="keyword token"&gt;get&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;licenseename_c&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="comment token"&gt;//get the account bean&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;var&lt;/span&gt; accountBean &lt;span class="operator token"&gt;=&lt;/span&gt; app&lt;span class="punctuation token"&gt;.&lt;/span&gt;data&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;createBean&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;Accounts&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt; &lt;span class="punctuation token"&gt;{&lt;/span&gt;id&lt;span class="punctuation token"&gt;:&lt;/span&gt; newAcccountID&lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;var&lt;/span&gt; accountLicenseeName &lt;span class="operator token"&gt;=&lt;/span&gt; &lt;span class="string token"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestAccount &lt;span class="operator token"&gt;=&lt;/span&gt; accountBean&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;fetch&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestAccount&lt;span class="punctuation token"&gt;.&lt;/span&gt;xhr&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;done&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="keyword token"&gt;function&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; accountLicenseeName &lt;span class="operator token"&gt;=&lt;/span&gt; accountBean&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="keyword token"&gt;get&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;account_licenseename_c&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="comment token"&gt;//once you have the Account information you can copy account_licenseename_c to licenseename_c&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;log&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;accountBean&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;toJSON&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;log&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;accountLicenseeName&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="keyword token"&gt;this&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;model&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="keyword token"&gt;set&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="string token"&gt;&amp;#39;licenseename_c&amp;#39;&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;accountLicenseeName&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="punctuation token"&gt;}&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="line-numbers-rows"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="margin:0in;font-size:11.0pt;"&gt;My console.log lines show the information as expected.&lt;/p&gt;&lt;pre class="language-javascript" style="margin:0in;font-size:11.0pt;"&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;log&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;accountBean&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;toJSON&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;log&lt;/span&gt;&lt;span class="punctuation token"&gt;(&lt;/span&gt;accountLicenseeName&lt;span class="punctuation token"&gt;)&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="margin:0in;font-size:11.0pt;"&gt;Any help or ideas on the best way to resolve this would be greatly appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1464?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2016 14:47:42 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:49dd8630-5b4d-4f45-b6d9-5d7b4fab6455</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;I would think the bean.set leverages the api, so the performance wouldn&amp;#39;t necessarily be better one way or another. After all both need to affect the database.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;FrancescaS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1463?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2016 14:34:28 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:6d9c34b6-f64c-49fd-863b-54bff6566734</guid><dc:creator>Caim Astraea</dc:creator><description>&lt;p&gt;Oh &lt;span class="emoticon_happy emoticon-inline" style="height:16px;width:16px;"&gt;&lt;/span&gt; Interesting thanks! So many ways to skin a cat. &lt;/p&gt;&lt;p&gt;Did it with the api.call initially&lt;/p&gt;&lt;p&gt;The bean.set offers superior performance I would reckon since there is no network overhead ?&lt;/p&gt;&lt;pre class="javascript"&gt;requestAccount.xhr.done(function(){
&amp;nbsp; //once you have the Account information compare the visit dates
&amp;nbsp; if ( moment(pcaDatVisite).isAfter(accountBean.get(&amp;#39;v_der_date_visite_c&amp;#39;).substr(0,10))) {
&amp;nbsp; //update the date visite of account using api.call
&amp;nbsp; //once you have the Account you can update the values you need to update


&amp;nbsp; accountBean.set(&amp;#39;ca_autocompl_c&amp;#39;, new Date(pcaDatVisite));
&amp;nbsp; // save your changes
&amp;nbsp; accountBean.save();
&amp;nbsp; /*
&amp;nbsp; app.api.call(&amp;#39;update&amp;#39;, app.api.buildURL(&amp;#39;Accounts/&amp;#39;+relAccId), { &amp;quot;v_der_date_visite_c&amp;quot; : new Date(pcaDatVisite)}, {
&amp;nbsp; success: _.bind(function(response) {
&amp;nbsp; //response comes back from your api, maybe you want to set some value on your model or alter a response?
&amp;nbsp; }, this)
&amp;nbsp; });
&amp;nbsp; */
&amp;nbsp; }
&amp;nbsp; });
&lt;/pre&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1462?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2016 13:22:33 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:ff7f5503-6ecf-4dc3-907f-7e616e4a090a</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;So you want to update the related Account from within the Opportunities view controller?&lt;/p&gt;&lt;p&gt;You should be able to do that:&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get the account bean&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var accountBean = app.data.createBean(&amp;#39;Accounts&amp;#39;, {id: account_id});&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestAccount = accountBean.fetch();&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;requestAccount.xhr.done(&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;function&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;()&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //once you have the Account you can update the values you need to update&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; accountBean.set(&amp;#39;the_field&amp;#39;, the_value);&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // save your changes&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; accountBean.save();&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;HTH&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="font-size:14px;color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;FrancescaS&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1461?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2016 08:41:44 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d22c6414-561f-4f5a-a5f3-8a1798423587</guid><dc:creator>Caim Astraea</dc:creator><description>&lt;p&gt;Hello , &lt;/p&gt;&lt;p&gt;Francesca , do you know if this would be possible to do in reverse ? I guess calling model.set on the account.bean is not possible ? So would have the update it with an app.api.call ? app.api.call(&amp;#39;update&amp;#39;, app.api.buildURL(&amp;#39;Accounts/&amp;#39;+accountid), {&amp;quot;accountfield&amp;quot; : &amp;quot;value&amp;quot; }, callbacks...&amp;nbsp; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1454?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 21:10:27 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:667ff14a-8821-4b50-b390-1d5f930ab37a</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;In &lt;span style="color:#000000;"&gt;custom/modules/Opportunities/clients/base/view/record/record.js you extend record view and you need this for when you edit an existing record.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;You need the create-actions for when you create an Opportunity from scratch, a new one.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;So you need two pieces of code which are almost identical, the one above in &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;custom/modules/Opportunities/clients/base/view/create-actions/create-actions.js&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;and in&lt;/span&gt;&lt;/p&gt;&lt;p&gt;custom/modules/Opportunities/clients/base/view/record/record.js&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;(&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p2" style="color:#000000;"&gt;&lt;span class="s3" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp; extendsFrom: &lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;#39;&lt;strong&gt;RecordView&lt;/strong&gt;&amp;#39;&lt;/span&gt;&lt;span class="s3" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;,&lt;/span&gt;&lt;/p&gt;&lt;p class="p3"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&lt;/span&gt; &amp;nbsp;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp; initialize: &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;function&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;(options)&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p2" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;this&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;._super(&lt;/span&gt;&lt;span class="s4" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;#39;initialize&amp;#39;&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;, &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;[&lt;/span&gt;&lt;span class="s1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;options&lt;/span&gt;&lt;span class="s2" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;]&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;);&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;this&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;.model.on(&lt;/span&gt;&lt;span class="s4" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;#39;change:account_id&amp;#39;&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;, &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;this&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;.populateMyOppField, &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;this&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;}&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;,&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;populateMyOppField: function(){&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp; //if the account field on the opportunity is not empty (we just changed it and it could have been deleted)&lt;/span&gt;&lt;/p&gt;&lt;p style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;if&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;(!_.isEmpty(&lt;/span&gt;&lt;span class="s3" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;this&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;.model.get(&lt;/span&gt;&lt;span class="s4" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;#39;account_id&amp;#39;&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;)) {&lt;/span&gt;&lt;/p&gt;&lt;p style="color:#000000;"&gt;&lt;span class="s3" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if the field on the opp is not already set, you&amp;#39;ll need this more on edit than create not to override prior values&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(_.isEmpty(this.model.get(&amp;#39;my_opportunity_field&amp;#39;))){&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get the account bean&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var accountBean = app.data.createBean(&amp;#39;Accounts&amp;#39;, {id: account_id});&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestAccount = accountBean.fetch();&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;requestAccount.xhr.done(&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;function&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;()&lt;/span&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //once you have the Account information you can copy my_account_field to my_opportunity_field&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.model.set(&amp;#39;my_opportunity_field&amp;#39;, accountBean.get(&amp;#39;my_account_field&amp;#39;));&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s2" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;},&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="color:#000000;"&gt;&lt;span class="s1" style="font-weight:inherit;font-style:inherit;font-family:inherit;"&gt;});&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;HTH&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;FrancescaS&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1453?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 20:10:19 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:6502a4de-cbef-4931-8191-ecbc9f3c501b</guid><dc:creator>Oscar Castro</dc:creator><description>&lt;p&gt;Thanks a lot!! Worked perfectly &lt;span class="emoticon-inline emoticon_grin" style="height:16px;width:16px;"&gt;&lt;/span&gt; . But i have a question, why extends the &lt;span style="color:#000000;"&gt;CreateActionsView? this manages the events in the record view?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modify return data from related field</title><link>https://sugarclub.sugarcrm.com/thread/1452?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 18:49:52 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:4c9415fd-dd17-40e5-8eb1-075ddd58c7be</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;If I understand correctly you have an Account on an Opportunity.&lt;/p&gt;&lt;p&gt;When you select an Account on the Opportunity you want to copy field my_account_field from Accounts to field my_opportunity_field on Opportunity but the user should be able to change the Opportunity field from that default if they wish to do so.&lt;/p&gt;&lt;p&gt;I am assuming Account is a Relate Field on Opportunity so the Opportunity will have an account_id&lt;/p&gt;&lt;p&gt;I would do this as an on.change on the account_id field on the opportunity in the Opportunity&amp;#39;s record and create-actions view and check that the opportunity field is not already filled (you don&amp;#39;t want to override what it was set to on an existing opportunity when it&amp;#39;s edited).&lt;/p&gt;&lt;p&gt;You will need something like:&lt;/p&gt;&lt;p&gt;In custom/modules/Opportunities/clients/base/view/create-actions/create-actions.js&lt;/p&gt;&lt;p&gt;and similar in&amp;nbsp; custom/modules/Opportunities/clients/base/view/record/record.js&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p2"&gt;&lt;span class="s3"&gt;&amp;nbsp; extendsFrom: &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;CreateActionsView&amp;#39;&lt;/span&gt;&lt;span class="s3"&gt;,&lt;/span&gt;&lt;/p&gt;&lt;p class="p3"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp; initialize: &lt;/span&gt;&lt;span class="s2"&gt;function&lt;/span&gt;&lt;span class="s1"&gt;(options)&lt;/span&gt;&lt;span class="s2"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p2"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;this&lt;/span&gt;&lt;span class="s1"&gt;._super(&lt;/span&gt;&lt;span class="s4"&gt;&amp;#39;initialize&amp;#39;&lt;/span&gt;&lt;span class="s1"&gt;, &lt;/span&gt;&lt;span class="s2"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;options&lt;/span&gt;&lt;span class="s2"&gt;]&lt;/span&gt;&lt;span class="s1"&gt;);&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;span class="s1" style="line-height:1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s2" style="line-height:1.5;"&gt;this&lt;/span&gt;&lt;span class="s1" style="line-height:1.5;"&gt;.model.on(&lt;/span&gt;&lt;span class="s4" style="line-height:1.5;"&gt;&amp;#39;change:account_id&amp;#39;&lt;/span&gt;&lt;span class="s1" style="line-height:1.5;"&gt;, &lt;/span&gt;&lt;span class="s2" style="line-height:1.5;"&gt;this&lt;/span&gt;&lt;span class="s1" style="line-height:1.5;"&gt;.populateMyOppField, &lt;/span&gt;&lt;span class="s2" style="line-height:1.5;"&gt;this&lt;/span&gt;&lt;span class="s1" style="line-height:1.5;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;,&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;populateMyOppField: function(){&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp; //if the account field on the opportunity is not empty (we just changed it and it could have been deleted)&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span class="s1"&gt; if&lt;/span&gt;&lt;span class="s2"&gt;(!_.isEmpty(&lt;/span&gt;&lt;span class="s3"&gt;this&lt;/span&gt;&lt;span class="s2"&gt;.model.get(&lt;/span&gt;&lt;span class="s4"&gt;&amp;#39;account_id&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)) {&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="s3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if the field on the opp is not already set, you&amp;#39;ll need this more on edit than create not to override prior values&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(_.isEmpty(this.model.get(&amp;#39;my_opportunity_field&amp;#39;))){ &lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get the account bean&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var accountBean = app.data.createBean(&amp;#39;Accounts&amp;#39;, {id: account_id});&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; requestAccount = accountBean.fetch();&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;requestAccount.xhr.done(&lt;/span&gt;&lt;span class="s2"&gt;function&lt;/span&gt;&lt;span class="s1"&gt;()&lt;/span&gt;&lt;span class="s2"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //once you have the Account information you can copy my_account_field to my_opportunity_field&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.model.set(&amp;#39;my_opportunity_field&amp;#39;, accountBean.get(&amp;#39;my_account_field&amp;#39;));&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;},&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;});&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Note the code is just intended to give you an idea, it is not tested, it&amp;#39;s written off the cuff, so there could be syntax errors.&lt;/p&gt;&lt;p&gt;There may be a better/easier way of doing this.&lt;/p&gt;&lt;p&gt;HTH&lt;/p&gt;&lt;p&gt;FrancescaS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>