<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged model</title>
<link>https://overflow.efficy.io/?qa=tag/model</link>
<description>Powered by Question2Answer</description>
<item>
<title>Document and Opportunity model : add property like 'EditEntityGridActi'</title>
<link>https://overflow.efficy.io/?qa=3721/document-opportunity-model-property-editentitygridacti</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Efficy version : 10.2&lt;/p&gt;

&lt;p&gt;In the TabContentProds (Edit window of Documents and Opportunities), I need that the client scripts in MacroEditS do some computations following the value of some fields of PRODUCTS&lt;br&gt;
I mean for example the have to do &lt;strong&gt;2+2 if PRODUCTS.FAMILY==1&lt;/strong&gt; or &lt;strong&gt;2*2 if PRODUCTS.FAMILY != 1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But, &lt;strong&gt;I do not want to&lt;/strong&gt; put the value of PRODUCTS.FAMILY in the html (example) :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;tr class=&quot;mission&quot; data-family=&amp;lt;#F=FAMILY;nospace=T&amp;gt; [...] &amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and use it in MacroEditS like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$('.mission').each(function() {
  var family = $(this).data('family');
})
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I would prefer to use the Model, is it possible to add &lt;strong&gt;'EditEntityGridProd'&lt;/strong&gt; like &lt;strong&gt;'EditEntityGridActi'&lt;/strong&gt; in &lt;strong&gt;'JsonEditModel.Docu/editEntityGrids'&lt;/strong&gt; ?&lt;/p&gt;

&lt;p&gt;Am I obliged to use &lt;strong&gt;'&amp;lt;%GetRelationGrid([...])%&amp;gt;'&lt;/strong&gt; in the Model ? This function tag is already used to generate the html grid in 'TabContentProds' so can I not generate this part of the model here ?&lt;/p&gt;

&lt;p&gt;Last question : How to access it in the script ?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// 1 because I will place it in the array after EditEntityGridActi
var ProductsData = Model('editEntityGrids[1]')
// or
var ProductsData = Model('editEntityGrids')[1]
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>How to</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3721/document-opportunity-model-property-editentitygridacti</guid>
<pubDate>Fri, 07 Dec 2018 11:40:49 +0000</pubDate>
</item>
<item>
<title>error after adding custom value to the model</title>
<link>https://overflow.efficy.io/?qa=2824/error-after-adding-custom-value-to-the-model</link>
<description>&lt;p&gt;Hi all!&lt;/p&gt;

&lt;p&gt;A wanted to change &quot;belgium financial buttons&quot; with others in Company:&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=700374284893068016&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;

&lt;p&gt;To do this, my function (that works) in consultToolsCmd.js need to access Model('F_SIRET')&lt;/p&gt;

&lt;p&gt;So I customized MacroConsultCustom.txt like that:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;//new buttons definition
ConsultCmdsTools.Comp      {[CmdMap;FindOnSocieteCom;FindOnInfogreffeFr;FindOnCorporamaCom]}

//buttons call send msg in my channel : financialFR
FindOnSocieteCom {[&amp;lt;%Macro(name=$macro$, $_more$=$more$, $class$=&quot;&quot;, $icon$=&quot;i-money&quot;, $caption$=&quot;voir sur societe.com&quot;, $msg$=&quot;financialFR;societe.com&quot;, $macro_sub_menu$=&quot;&quot;)%&amp;gt;]}
FindOnInfogreffeFr {[&amp;lt;%Macro(name=$macro$, $_more$=$more$, $class$=&quot;&quot;, $icon$=&quot;i-money&quot;, $caption$=&quot;voir sur infogreffe.fr&quot;, $msg$=&quot;financialFR;infogreffe.fr&quot;, $macro_sub_menu$=&quot;&quot;)%&amp;gt;]}
FindOnCorporamaCom {[&amp;lt;%Macro(name=$macro$, $_more$=$more$, $class$=&quot;&quot;, $icon$=&quot;i-money&quot;, $caption$=&quot;voir sur corporama.com&quot;, $msg$=&quot;financialFR;corporama.com&quot;, $macro_sub_menu$=&quot;&quot;)%&amp;gt;]}

//Add the field to the Model (my script need it)
JsonConsultModelCustom {[
        ,&quot;F_SIRET&quot;: &quot;&amp;lt;%GetField(F_SIRET,type=JSTEXT)%&amp;gt;&quot;
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And finally i added a line in require.config.js&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require.overrideModule('commands/consultToolsCmd');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;My buttons works an Exception is thrown in Product and Contact:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Message: DS&lt;em&gt;ProdConsult&lt;/em&gt;0&lt;em&gt;Prod: Field 'F&lt;/em&gt;SIRET' not found&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don't understand why the Exception is thrown only in these entities (an Opportunity don't have F_SIRET)..&lt;/p&gt;

&lt;p&gt;Do I have to override JsonConsultModel.Comp instead of JsonConsultModelCustom ??&lt;/p&gt;

&lt;p&gt;Thanks a lot!&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2824/error-after-adding-custom-value-to-the-model</guid>
<pubDate>Mon, 11 Dec 2017 11:51:21 +0000</pubDate>
</item>
</channel>
</rss>