<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarai.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>SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/dev-club/f/questions-answers/6877/sugarcrm-api-metadata-endpoint-properties---how-to-define-an-updatable-field</link><description>Hi, 
 When querying the /rest/v11/metadata?type_filter=modules endpoint we can see the list of fields under the /fields object. 
 Some fields have the property &amp;quot;readonly&amp;quot;, as the name implies this defines if this field can be used on Create/Update endpoints</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30729?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 20:32:55 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:f419109b-f521-4267-853b-118f1e221029</guid><dc:creator>Rafael Fernandes</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;a href="/members/joana"&gt;Joana H&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;div id="1706731103.216269" class="c-virtual_list__item" data-qa="virtual-list-item" data-item-key="1706731103.216269"&gt;
&lt;div class="c-message_kit__background p-message_pane_message__message c-message_kit__message" data-qa="message_container" data-qa-unprocessed="false" data-qa-placeholder="false"&gt;
&lt;div class="c-message_kit__hover" data-qa-hover="true"&gt;
&lt;div class="c-message_kit__actions c-message_kit__actions--default"&gt;
&lt;div class="c-message_kit__gutter"&gt;
&lt;div class="c-message_kit__gutter__right" data-qa="message_content"&gt;
&lt;div class="c-message_kit__blocks c-message_kit__blocks--rich_text"&gt;
&lt;div class="c-message__message_blocks c-message__message_blocks--rich_text" data-qa="message-text"&gt;
&lt;div class="p-block_kit_renderer" data-qa="block-kit-renderer"&gt;
&lt;div class="p-block_kit_renderer__block_wrapper p-block_kit_renderer__block_wrapper--first"&gt;
&lt;div class="p-rich_text_block" dir="auto"&gt;
&lt;div class="p-rich_text_section"&gt;I gathered few smart engineers here to answer your question so here it is:&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;It&amp;#39;s not easily determined from metadata alone because there are several ways it can hit a &lt;code&gt;readonly&lt;/code&gt; condition:&lt;/div&gt;
&lt;ol class="p-rich_text_list p-rich_text_list__ordered" data-stringify-type="ordered-list" data-indent="0" data-border="0"&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Field is defined as&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;&amp;#39;readonly&amp;#39; =&amp;gt; true&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;,&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Field is defined as&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;&amp;#39;calculated&amp;#39; =&amp;gt; true&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;as Sid noted, but only if&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;&amp;#39;enforced&amp;#39; =&amp;gt; false&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is not also set&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;Field is defined as conditionally readonly based on a SugarLogic formula, for example:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="c-mrkdwn__code" data-stringify-type="code"&gt;&amp;#39;readonly_formula&amp;#39; =&amp;gt; &amp;#39;not(equal($id,&amp;quot;&amp;quot;))&amp;#39;,&lt;/code&gt;&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;There are Role restrictions not available through metadata&lt;/li&gt;
&lt;li data-stringify-indent="0" data-stringify-border="0"&gt;There may be JS code in a particular view that make the field readonly at runtime&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="1706731115.801639" class="c-virtual_list__item" data-qa="virtual-list-item" data-item-key="1706731115.801639"&gt;
&lt;div class="c-message_kit__background p-message_pane_message__message c-message_kit__message" data-qa="message_container" data-qa-unprocessed="false" data-qa-placeholder="false"&gt;
&lt;div class="c-message_kit__hover" data-qa-hover="true"&gt;
&lt;div class="c-message_kit__actions c-message_kit__actions--above"&gt;
&lt;div class="c-message_kit__gutter"&gt;
&lt;div class="c-message_kit__gutter__left"&gt;
&lt;div class="p-message_pane_message__compact_timestamp p-message_pane_message__compact_timestamp--light p-message_pane_message__compact_timestamp--adjacent"&gt;&lt;a class="c-link c-timestamp" href="https://sugarcrm.slack.com/archives/C4SAHPQCA/p1706731115801639" data-stringify-type="replace" data-stringify-requires-siblings="true" data-ts="1706731115.801639" data-sk="tooltip_parent"&gt;&lt;span class="c-timestamp__label" data-qa="timestamp_label"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="1706732323.960369" class="c-virtual_list__item" data-qa="virtual-list-item" data-item-key="1706732323.960369"&gt;
&lt;div class="c-message_kit__background p-message_pane_message__message c-message_kit__message" data-qa="message_container" data-qa-unprocessed="false" data-qa-placeholder="false"&gt;
&lt;div class="c-message_kit__hover" data-qa-hover="true"&gt;
&lt;div class="c-message_kit__actions c-message_kit__actions--default"&gt;
&lt;div class="c-message_kit__gutter"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="c-virtual_list__item" data-qa="virtual-list-item" data-item-key="1706732323.960369"&gt;Perhaps if you share your use case with all of us, we could come up with a suggestion.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30727?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 16:07:02 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:01632dc9-c272-47d0-aaeb-9075dbbbafe7</guid><dc:creator>Joana H</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/rafael-fernandes"&gt;Rafael Fernandes,&lt;/a&gt;&amp;nbsp;do you have any other idea from a developer&amp;#39;s point of view?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30306?ContentTypeID=1</link><pubDate>Fri, 10 Nov 2023 23:22:31 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:1b5c57fc-04e5-4324-8880-d6a9f2638ae5</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Properties such as &amp;quot;required&amp;quot;, field dependencies, and field validations, are functions of the front end. &lt;br /&gt;The APIs do not respect any of those.&lt;br /&gt;It is up to the developer of the application that calls the SugarAPI to make sure that the validation is done before the payload is added to the API call.&lt;/p&gt;
&lt;p&gt;Similarly you need to know the difference between relationships and relate field to correctly create links between different entities. For relate fields you can simply add the id of the parent in the FK field, but for relationships you need a separate API call once both ends of the relationship have been saved and have an ID.&lt;/p&gt;
&lt;p&gt;In other words, you need to know your particular instance of Sugar very well to work with APIs,&amp;nbsp;you need to know what checks and balances to enforce before the API is even called and you need to know how back end information like &amp;quot;link&amp;quot; names to add relationships.&lt;/p&gt;
&lt;p&gt;It is one reason I suggested limiting user access to APIs, you can do quite a bit of damage to your data if you don&amp;#39;t know what you are doing when calling an API.&lt;br /&gt;&lt;a href="https://portal.sugarondemand.com/#supp_Bugs/67b3ee38-d49a-11ed-9358-06e41dba421a"&gt;portal.sugarondemand.com/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30301?ContentTypeID=1</link><pubDate>Fri, 10 Nov 2023 16:16:02 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:dab595d4-d094-4740-9530-65a3ad532003</guid><dc:creator>Joana H</dc:creator><description>&lt;p&gt;Then how can we define if a field is a base field of that module and not a foreign key or a field of a child?&lt;/p&gt;
&lt;p&gt;Why doesn&amp;#39;t the server throw errors when trying to insert read-only properties?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30259?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 19:08:11 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:ca1ab81a-145b-43bc-b2a8-0a182f39a214</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;SugarFavorites does not have an Account_name/Account_id&lt;/p&gt;
&lt;p&gt;aside from that, I don&amp;#39;t think you can tell from the metadata what the DB-level constraints may be.&lt;/p&gt;
&lt;p&gt;Francesca&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30258?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 17:24:39 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:497c5035-54ab-4b4a-b593-b4f8a8549b5b</guid><dc:creator>Joana H</dc:creator><description>&lt;p&gt;Thanks for the feedback. Yes, the user ACL is one point.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s say we have an admin user that has all the required access to all CRUD operations.&lt;/p&gt;
&lt;p&gt;What happens is that this user cannot update the properties of a child object.&lt;/p&gt;
&lt;p&gt;For instance:&lt;/p&gt;
&lt;p&gt;module name:&amp;nbsp;&lt;span&gt;SugarFavorites&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Not allowed update on:&amp;nbsp;&lt;strong&gt;Account_Name &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Allowed update on&amp;nbsp;&lt;strong&gt;Account_id (this will update the Account_name under the hood since it&amp;#39;s a foreign key)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This looks like a DB constraint depending on the data model/schema. I&amp;#39;d like to know&amp;nbsp;based on what metadata properties combination I can throw an error to my users when trying to update/insert those fields.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SugarCRM API Metadata endpoint. Properties - How to define an updatable field?</title><link>https://sugarclub.sugarai.com/thread/30257?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 17:11:57 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:63d31fa1-188f-4ec2-96d6-8f2898b05bf6</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;To the best of my knowledge (and I am by no means an expert about metadata) the read only in the metadata definition is only for those fields that are inherently read only like calculated fields.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When it comes to what the user can read-write it is not controlled in the API itself but by the ACLs, the user&amp;#39;s Role dictates whether they have access to that field and in what capacity.&lt;/p&gt;
&lt;p&gt;There is very little control in the APIs themselves and you need to be very careful to enforce the quality of your data in the construction of the API&amp;#39;s payload itself.&lt;/p&gt;
&lt;p&gt;There is, for example, no check inside the API that an enum value is valid, or that dependencies are enforced, those are all&amp;nbsp;enforced by the user interface, not the underlying APIs.&lt;/p&gt;
&lt;p&gt;Does this answer your question?&lt;/p&gt;
&lt;p&gt;FrancescaS&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;PS. you can find more information about the data framework Sugar uses here, though perhaps not in as much detail as you are looking for:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://support.sugarcrm.com/documentation/sugar_developer/sugar_developer_guide_12.0/data_framework/vardefs/"&gt;support.sugarcrm.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>