<?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>How to create a relation to a record from another table in a post request</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/8020/how-to-create-a-relation-to-a-record-from-another-table-in-a-post-request</link><description>Hi there, How do I create the relationship to a record from another table in a post request? 
 I am creating a record with data from a registered customer device with a post request to the &amp;quot;Installed Base&amp;quot; custom module. The Accounts module has a one</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to create a relation to a record from another table in a post request</title><link>https://sugarclub.sugarcrm.com/thread/32908?ContentTypeID=1</link><pubDate>Fri, 14 Mar 2025 21:21:07 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:028e49b2-925c-4992-ba81-19748cb339f0</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Glad you were able to get it to work. Sounds like your Account field in the installed base module is a Relate field.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a relation to a record from another table in a post request</title><link>https://sugarclub.sugarcrm.com/thread/32907?ContentTypeID=1</link><pubDate>Fri, 14 Mar 2025 20:25:42 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:e35e0319-58cf-44cc-b2f2-210c30675905</guid><dc:creator>Steffen Scheid</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;&amp;nbsp;&lt;a href="/members/liamh"&gt;Liam Hastings&lt;/a&gt;&amp;nbsp;&amp;nbsp;- that&amp;#39;s a very good tip!&lt;br /&gt;Best regards,&lt;br /&gt;Steffen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a relation to a record from another table in a post request</title><link>https://sugarclub.sugarcrm.com/thread/32906?ContentTypeID=1</link><pubDate>Fri, 14 Mar 2025 20:21:47 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:f0044803-d223-42cd-9717-c4baeaeaa451</guid><dc:creator>Steffen Scheid</dc:creator><description>&lt;p&gt;Thank you &lt;a href="/members/francescas"&gt;Francesca Shiekh&lt;/a&gt;&amp;nbsp;, this is very helpful. I was able to solve it even easier, in the module installed_base was a field &amp;quot;account_id&amp;quot; - if I pass a valid account_id, the relation is created!&lt;br /&gt;&lt;br /&gt;All the best,&lt;br /&gt;Steffen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a relation to a record from another table in a post request</title><link>https://sugarclub.sugarcrm.com/thread/32900?ContentTypeID=1</link><pubDate>Thu, 13 Mar 2025 08:44:02 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:85927bda-b461-46d8-a331-e9879180a36d</guid><dc:creator>Liam Hastings</dc:creator><description>&lt;p&gt;&amp;nbsp;The answer from&amp;nbsp;&lt;a href="/members/francescas"&gt;Francesca Shiekh&lt;/a&gt;&amp;nbsp; is what you want here. But in case it helps &lt;a href="/members/sscheid"&gt;Steffen Scheid&lt;/a&gt;&amp;nbsp;the UI actually consumes its own API so sometimes in instances like this the easiest way to work out how to do it over the API is to do it in the UI and watch the network requests it makes. Just thought I would put that out there in case you were not aware.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create a relation to a record from another table in a post request</title><link>https://sugarclub.sugarcrm.com/thread/32897?ContentTypeID=1</link><pubDate>Wed, 12 Mar 2025 21:09:43 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:f11dfb04-b58d-4146-a072-1184349f6cb2</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;a href="/members/sscheid"&gt;Steffen Scheid&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;To create a record &lt;/span&gt;&lt;span class="hljs-literal"&gt;that&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="hljs-keyword"&gt;is&lt;/span&gt;&lt;span&gt; related &lt;/span&gt;&lt;span class="hljs-keyword"&gt;to&lt;/span&gt;&lt;span&gt; an existing record you can start &lt;/span&gt;&lt;span class="hljs-keyword"&gt;from&lt;/span&gt;&lt;span&gt; the existing record you want &lt;/span&gt;&lt;span class="hljs-keyword"&gt;to&lt;/span&gt;&lt;span&gt; relate &lt;/span&gt;&lt;span class="hljs-keyword"&gt;to.&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Use: &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;a href="https://support.sugarcrm.com/documentation/sugar_developer/sugar_developer_guide_14.2/integration/web_services/rest_api/endpoints/modulerecordlinklink_name_post/"&gt;&amp;lt;module&amp;gt;/:record/link/:link_name POST&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So, in your example, let&amp;#39;s pretend your&lt;/span&gt;&lt;span&gt;&amp;nbsp;accountID is&amp;nbsp;ffe8d826-81cb-11e7-8d9e-001a4a160206&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and the relationship between your Accounts and Installed Base modules is called: inst_installedbase_accounts_1&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To create an IstallBase relaed to that Account the&amp;nbsp;API will be:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Accounts/ffe8d826-81cb-11e7-8d9e-001a4a160206/link/inst_installedbase_accounts_1&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;FrancescaS&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="hljs-keyword"&gt;&lt;/span&gt;PS. The easiest way to find the link_name is in the cached vardefs:&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;cache/modules/Accounts/Accountvardefs.php&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;search for your module name for the Installed Base.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>