<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged relation</title>
<link>https://overflow.efficy.io/?qa=tag/relation</link>
<description>Powered by Question2Answer</description>
<item>
<title>problem occurs when deleting a relation link (Prod_Case)</title>
<link>https://overflow.efficy.io/?qa=6623/problem-occurs-when-deleting-a-relation-link-prodcase</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I have a problem when I'm trying to delete the relation PROD-CASE :&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.io/?qa=blob&amp;amp;qa_blobid=1109487536647037541&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;
In the function deleteRelation, the detailKey return keyProd-KRelation &lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.io/?qa=blob&amp;amp;qa_blobid=3127600058749840060&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;
It displays this error : &lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.io/?qa=blob&amp;amp;qa_blobid=13037993170548430785&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;
There is a custom that has been added in the field (K_RELATION)&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.io/?qa=blob&amp;amp;qa_blobid=9120668940095194742&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;

&lt;p&gt;Which tables I need to check to make the delete relation works ? &lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=6623/problem-occurs-when-deleting-a-relation-link-prodcase</guid>
<pubDate>Thu, 07 Jul 2022 15:44:22 +0000</pubDate>
</item>
<item>
<title>How to add Documents, tasks, products, opportunities, cases, mails to a Step like if it was into Stage.</title>
<link>https://overflow.efficy.io/?qa=5660/documents-tasks-products-opportunities-cases-mails-stage</link>
<description>&lt;p&gt;I need to link documents, tasks, products, opportunities, cases, mails to a Step like if it was into a Stage.&lt;br&gt;
I added a new tab products on stages and it work sot the method to attach tables is ok, but no one of the tab is working when I call a step. I saw that some of WkldEditDetailTabHeaders and WkldEditDetailTabContents was filter by &amp;lt;# if (!isStep) { #&amp;gt; or &amp;lt;# if (isStep) { #&amp;gt;&lt;/p&gt;

&lt;p&gt;So in my custom I changed some stuff to make it appear and I created a variant of the addLink button to have &lt;br&gt;
&lt;strong&gt;data-msg=&quot;addLink;WrkStep;&amp;lt;#=@ data.key #&amp;gt;;$detail$&quot;&lt;/strong&gt; or &lt;strong&gt;data-msg=&quot;addLink;WrkStag;&amp;lt;#=@ data.key #&amp;gt;;$detail$&quot;&lt;/strong&gt; both (WrkStep and WrkStag) are existing into the sys_tableviews. &lt;br&gt;
Why it has no effect on addLink for steps while it work's on step. I call only a basic addLink.&lt;/p&gt;

&lt;p&gt;Into MacroWorkloadCustom I changed the standard like this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For main entity commnands :&lt;/strong&gt; &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;WkldEditDetailTabHeaders {[WkldTabHeaderFields;WkldTabHeaderMemo;WkldTabHeaderActi;WkldTabHeaderCase;WkldTabHeaderDocu;WkldTabHeaderMail;WkldTabHeaderOppo;WkldTabHeaderProd]}
WkldEditDetailTabContents {[WkldTabContentFields;WkldTabContentMemo;WkldTabContentActi;WkldTabContentCase;WkldTabContentDocu;WkldTabContentMail;WkldTabContentOppo;WkldTabContentProd]}
WkldDetailGridColumns..Prod {[MENU2,NAME]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;For workload MicroTemplate :&lt;/strong&gt; &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;WkldTabHeaderActi   {[&amp;lt;dd&amp;gt;&amp;lt;a href=&quot;#tab-acti&quot; class=&quot;i-Acti&quot; draggable=&quot;false&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/dd&amp;gt;]}
WkldTabHeaderCase   {[&amp;lt;dd&amp;gt;&amp;lt;a href=&quot;#tab-case&quot; class=&quot;i-Case&quot; draggable=&quot;false&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/dd&amp;gt;]}
WkldTabHeaderDocu   {[&amp;lt;dd&amp;gt;&amp;lt;a href=&quot;#tab-docu&quot; class=&quot;i-Docu&quot; draggable=&quot;false&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/dd&amp;gt;]}
WkldTabHeaderMail   {[&amp;lt;dd&amp;gt;&amp;lt;a href=&quot;#tab-mail&quot; class=&quot;i-Mail&quot; draggable=&quot;false&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/dd&amp;gt;]}
WkldTabHeaderOppo   {[&amp;lt;dd&amp;gt;&amp;lt;a href=&quot;#tab-oppo&quot; class=&quot;i-Oppo&quot; draggable=&quot;false&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/dd&amp;gt;]}
WkldTabHeaderProd   {[&amp;lt;dd&amp;gt;&amp;lt;a href=&quot;#tab-prod&quot; class=&quot;i-Prod&quot; draggable=&quot;false&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/dd&amp;gt;]}

WkldTabContentActi {[
&amp;lt;# if (!isStep) { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-acti&quot; data-entity=&quot;Acti&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetail', detail='Acti', $addlabel$='Add Link to Action')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } else { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-acti&quot; data-entity=&quot;Acti&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetailStep', detail='Acti', $addlabel$='Add Link to Action')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } #&amp;gt;
]}

WkldTabContentCase {[
&amp;lt;# if (!isStep) { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-case&quot; data-entity=&quot;Case&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetail', detail='Case', $addlabel$='Add Link to Incident')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } else { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-case&quot; data-entity=&quot;Case&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetailStep', detail='Case', $addlabel$='Add Link to Incident')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } #&amp;gt;
]}

WkldTabContentDocu {[
&amp;lt;# if (!isStep) { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-docu&quot; data-entity=&quot;Docu&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetail', detail='Docu', $addlabel$='Add Link to Document')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } else { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-docu&quot; data-entity=&quot;Docu&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetailStep', detail='Docu', $addlabel$='Add Link to Document')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } #&amp;gt;
]}

WkldTabContentMail {[
&amp;lt;# if (!isStep) { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-mail&quot; data-entity=&quot;Mail&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetail', detail='Mail', $addlabel$='Add Link to Mail')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } else { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-mail&quot; data-entity=&quot;Mail&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetailStep', detail='Mail', $addlabel$='Add Link to Mail')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } #&amp;gt;
]}

WkldTabContentOppo {[
&amp;lt;# if (!isStep) { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-oppo&quot; data-entity=&quot;Oppo&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetail', detail='Oppo', $addlabel$='Add Link to Opportunity')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } else { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-oppo&quot; data-entity=&quot;Oppo&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetailStep', detail='Oppo', $addlabel$='Add Link to Opportunity')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } #&amp;gt;
]}

WkldTabContentProd {[
&amp;lt;# if (!isStep) { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-prod&quot; data-entity=&quot;Prod&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetail', detail='Prod', $addlabel$='Add Link to Product')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } else { #&amp;gt;
&amp;lt;div class=&quot;content tabs-content-item&quot; id=&quot;tab-prod&quot; data-entity=&quot;Prod&quot;&amp;gt;
&amp;lt;%Macro('WkldTabContentDetailStep', detail='Prod', $addlabel$='Add Link to Product')%&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;# } #&amp;gt;
]}

WkldTabContentDetailStep {[
&amp;lt;div class=&quot;row&quot;&amp;gt;
&amp;lt;div class=&quot;small-2 medium-1 columns&quot;&amp;gt;
&amp;lt;button type=&quot;button&quot; class=&quot;icon i-add&quot; title=&quot;&amp;lt;%GetLabel('$addlabel$', context=ATTR)%&amp;gt;&quot; data-msg=&quot;addLink;WrkStep;&amp;lt;#=@ data.key #&amp;gt;;$detail$&quot;&amp;gt;&amp;lt;/button&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class=&quot;small-12 medium-11 columns&quot;&amp;gt;
&amp;lt;h3 class=&quot;section-title&quot;&amp;gt;&amp;lt;%GetLabel('$detail$s', context=TEXT)%&amp;gt;&amp;lt;/h3&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class=&quot;row&quot;&amp;gt;
&amp;lt;div class=&quot;small-12 columns wkld-detail-grid&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So I remove the if clause into the header and contents to remove the restriction on steps. And I added a macro called depending on if it's step or not. If yes the addling is done on WrkStep or if not on WrkStag.&lt;br&gt;
I have missed something to finish the job.&lt;/p&gt;
</description>
<category>How to</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=5660/documents-tasks-products-opportunities-cases-mails-stage</guid>
<pubDate>Fri, 23 Oct 2020 09:32:36 +0000</pubDate>
</item>
<item>
<title>Commit doesn't work on detail between custom entity and docu</title>
<link>https://overflow.efficy.io/?qa=4284/commit-doesnt-work-on-detail-between-custom-entity-and-docu</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I have created a new entity named &lt;code&gt;PAIEMENTS&lt;/code&gt;. I have added custom fields in the relation &lt;code&gt;PAIE_DOCU&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As function &lt;code&gt;AfterCommitOppoProd(oppoProdCxt, Inserted)&lt;/code&gt;  works, I thought that « &lt;code&gt;AfterCommitPaieDocu&lt;/code&gt; would work..... But, the folowing Commit operation doesn't work:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function AfterCommitPaieDocu(PaieDocuCxt, Inserted) {
var PaieDocuDS = Database.GetMasterDataset(PaieDocuCxt, 0);
var PaieKey = PaieDocuDS.FieldByName('K_PAIEMENT').AsFloat;
var DocuKey = PaieDocuDS.FieldByName('K_DOCUMENT').AsFloat;
var APayer = PaieDocuDS.FieldByName('F_A_PAYER').AsFloat;
var Paye = PaieDocuDS.FieldByName('F_PAYE').AsFloat;
var Ecart = PaieDocuDS.FieldByName('F_ECART').AsFloat;
var TotalPaye = Paye + Ecart;
PaieDocuDS.FieldByName('F_ENCAISSEMENT_VALIDE').AsInteger = 1;
Efficy.DisableWorkflow = true;
Efficy.CommitChanges(PaieDocuCxt, false);
Efficy.DisableWorkflow = false;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Do you know the reason?&lt;/p&gt;

&lt;p&gt;The following command works:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function OnInsertDetailPaieDocu(EditHandle, Detail, DetailKey) 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Thank you&lt;br&gt;
Dimitri&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4284/commit-doesnt-work-on-detail-between-custom-entity-and-docu</guid>
<pubDate>Thu, 16 May 2019 13:51:36 +0000</pubDate>
</item>
<item>
<title>Link Timesheet table to another table than project</title>
<link>https://overflow.efficy.io/?qa=4218/link-timesheet-table-to-another-table-than-project</link>
<description>&lt;p&gt;Hello, &lt;/p&gt;

&lt;p&gt;We did a customisation on the timesheet a few month ago that allow user to timesheet on opportunity &lt;strong&gt;or&lt;/strong&gt; project.&lt;/p&gt;

&lt;p&gt;The customisation work fine, the customer is happy, voilà.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;BUT&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, he want to &quot;analyse&quot; the data and make selections with them. Without native SQL, he cannot make a link between the table &quot;timesheet&quot; and &quot;opportunities&quot;, by default.&lt;/p&gt;

&lt;p&gt;I found the function tag &lt;code&gt;&amp;lt;%SelectJoinTable()%&amp;gt;&lt;/code&gt; in dialog/Tables.htm. How can I change things in &lt;code&gt;sys_relations&lt;/code&gt; and &lt;code&gt;sys_relentities&lt;/code&gt; to have the possibility to link opportunities to Timesheet ?&lt;/p&gt;

&lt;p&gt;Regards,&lt;/p&gt;

&lt;p&gt;Loïc&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4218/link-timesheet-table-to-another-table-than-project</guid>
<pubDate>Thu, 09 May 2019 19:53:42 +0000</pubDate>
</item>
<item>
<title>Questions about system tables (adding relations, ...)</title>
<link>https://overflow.efficy.io/?qa=4085/questions-about-system-tables-adding-relations</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I need to add &lt;strong&gt;ActiRelations&lt;/strong&gt; in &lt;strong&gt;EditRelationsList.Oppo&lt;/strong&gt; and I know that I have some SQL statements to execute in SQL Server. I'm trying to understand how the system tables work&lt;br&gt;
Can you tell me if I am right or explain to myself:&lt;/p&gt;

&lt;p&gt;SYS&lt;em&gt;TABLES: &lt;em&gt;Contains all existing tables in SQL Server. Efficy Designer uses it when the DB is &quot;upgraded&quot; (create/drop table)&lt;/em&gt;&lt;br&gt;
SYS&lt;/em&gt;FIELDS: &lt;em&gt;contains all the fields of each table (and virtual fields). Efficy Designer uses it when the database is &quot;upgraded&quot;&lt;/em&gt;&lt;br&gt;
SYS&lt;em&gt;RELATIONS: &lt;em&gt;Efficy uses this to join different tables (and specify whether there is a join table)&lt;/em&gt;&lt;br&gt;
SYS&lt;/em&gt;QUERIES: &lt;em&gt;Efficy uses it to generate queries for obtaining data in Consult&lt;/em&gt;&lt;br&gt;
SYS&lt;em&gt;TABLEVIEWS: &lt;em&gt;Efficy uses it to generate queries for obtaining data in Edit&lt;/em&gt;&lt;br&gt;
SYS&lt;/em&gt;ENTITYVIEWS: &lt;em&gt;Contains collections of TABLESVIEWS to know which data to enter in which view&lt;/em&gt;&lt;br&gt;
SYS_RELENTITIES: *I do not understand ??*&lt;/p&gt;

&lt;p&gt;Sorry if I did not speak clearly but it's a little vague for me&lt;/p&gt;

&lt;p&gt;I'm asking because I need to add ** ActiRelations ** to ** EditRelationsList.Oppo **.&lt;br&gt;
I found a sample script that adds the OBJV&lt;em&gt;PROF relationship with SQL statements. I'm trying to create my script from them.&lt;br&gt;
But it contains the following SQL statement:&lt;br&gt;
insert in SYS&lt;/em&gt;ENTITYVIEWS (NAME, ISCUSTOM, TABLEVIEWS) values ('Objv&lt;em&gt;Prof', 1, 'Objv&lt;/em&gt;Prof')&lt;/p&gt;

&lt;p&gt;I looked for the relation Acti-Mail in this one and I can not find any entry Acti&lt;em&gt;Mail or Mail&lt;/em&gt;Acti&lt;/p&gt;

&lt;p&gt;For the moment, my script looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-- add Actions in OppoEdit
Update SYS_ENTITYVIEWS set ISCUSTOM=1, TABLEVIEWS=(SELECT TABLEVIEWS FROM SYS_ENTITYVIEWS WHERE NAME = 'OppoEdit') + ';Oppo_Acti=Acti' where NAME='OppoEdit' 


-- Get Acti data from OppoEdit
insert into  SYS_TABLEVIEWS (NAME, K_TABLE, ISCUSTOM, SELECTFROM, SELECTFIELDS, SELECTJOIN, SELECTORDERBY) 
values ('Oppo_Acti', @K_TABLE, 1, 'ACTI_OPPO ACTI_OPPO, ACTIONS ACTIONS', 'ACTI_OPPO.*, ACTIONS.SUBJECT, ACTIONS.D_BEGIN, ACTIONS.DONE', 'ACTI_OPPO.K_ACTION = ACTIONS.K_ACTION', 'ACTIONS.D_BEGIN DESC, ACTIONS.SUBJECT');
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4085/questions-about-system-tables-adding-relations</guid>
<pubDate>Wed, 10 Apr 2019 13:26:29 +0000</pubDate>
</item>
<item>
<title>[Solution] Create and use a custom relation form for a K_RELATION between two Entities where there where no K_RELATION</title>
<link>https://overflow.efficy.io/?qa=3969/solution-relation-krelation-between-entities-krelation</link>
<description>&lt;p&gt;Hello Efficy Team, &lt;/p&gt;

&lt;p&gt;Because I would like that the Overflow become the source of knowledge for all our daily customisation, I took some time to put in a post a &quot;tricky&quot; customisation. This kind of demands are often asked by customer and we don't always respond to it the right way.&lt;/p&gt;

&lt;h2&gt;Create a custom relation form between Project and Contacts, using a K_RELATION&lt;/h2&gt;

&lt;h3&gt;First step : add a K&lt;em&gt;RELATION in PPROJ&lt;/em&gt;CONT&lt;/h3&gt;

&lt;p&gt;For the context: Efficy is used to manage the leasing of products. Each product can be lease to the same person at different moment. There is always one contact for a single period, but the same contact could lease the same product (or collection of product) multiple time. This is why we use project and we need a K_RELATION.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=13734223560222336668&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;

&lt;p&gt;Adding the K&lt;em&gt;RELATION is quite simple. Just add the field &quot;K&lt;/em&gt;RELATION&quot; in the sys&lt;em&gt;fields with DbEditor (with almost the same parameters as the K&lt;/em&gt;PROJECT and the K_CONTACT).&lt;/p&gt;

&lt;p&gt;Then make an apply structure.&lt;/p&gt;

&lt;h3&gt;Second (very easy) step : creating the form in the designer&lt;/h3&gt;

&lt;p&gt;This is the easiest part. Use the designer to create a new form on the table &quot;PROJ_CONT&quot;. Add the field that you've created. &lt;/p&gt;

&lt;p&gt;Don't forget to write the K_FORM somewhere, this will be useful for the next step.&lt;/p&gt;

&lt;h3&gt;Add the &quot;modify relation&quot; button and show the form&lt;/h3&gt;

&lt;p&gt;2 macros need to be modified : &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MacroConsultCustom

DetailMenu.Proj.Cont {[&amp;lt;%GetPopupMenu(id=&quot;detail-menu&quot;, class=&quot;has-icons small&quot;, ulargs='data-channel=&quot;detailmenu&quot;', count=&quot;4&quot;,
     text1=&quot;Edit #DETAIL&quot;, image1=&quot;i-edit&quot;,
     message1=&quot;edit;{dropdownKey};#DETAIL&quot;,
     text2=&quot;Edit Relation&quot;, image2=&quot;i-link&quot;, onlinehelp2=&quot;e110_linkitems&quot;,
     message2=`editRelation;#ENTITY;#KEY;#DETAIL;{dropdownKey}`,
     text3=&quot;Delete Relation&quot;, image3=&quot;i-delete&quot;, onlinehelp3=&quot;e110_linkitems&quot;,
     message3=&quot;deleteRelation;#ENTITY;#KEY;#DETAIL;{dropdownKey}&quot;,
     text4=&quot;Add Call Back Task&quot;, image4=&quot;i-callback&quot;,  onlinehelp4=&quot;e110_createcallbacktasks&quot;,
     message4=&quot;addCallBack;#ENTITY;#KEY;;{dropdownKey}&quot; 
)%&amp;gt;]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then you use the K_FORM of your new &quot;custom Project - Contact&quot;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MacroRelationCustom

RelationSectionsForm.Proj.Cont {[2]}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Editing the &quot;good&quot; relation&lt;/h3&gt;

&lt;p&gt;If you tested so far, you should see that you can &quot;edit the relation&quot; and your form is showing. But unfortunately, it does not show you current relation. Because we didn't specified witch relation need to be updated.&lt;/p&gt;

&lt;p&gt;We first need to retrieve the K&lt;em&gt;RELATION. For that, we'll duplicate the &quot;K&lt;/em&gt;MASTER=0;K&lt;em&gt;DETAIL=11&quot; and we'll create a new &quot;K&lt;/em&gt;MASTER=20;K_DETAIL=11&quot;&lt;/p&gt;

&lt;p&gt;We just add the K_RELATION on the column &quot;by default&quot; retrieved :&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=2308786652932697884&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;

&lt;p&gt;Then we'll overload the default &quot;consult queries&quot; for the relation &quot;PROJ_CONT&quot; :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MacroConsultCustom :

ConsultQueries.Proj.Cont {[
&amp;lt;%RunQuery(id=&quot;MainComp&quot;, SQL=&quot;select C.K_COMPANY, C.NAME from &amp;lt;#table name='PROJ_COMP'&amp;gt; PC, &amp;lt;#table name='COMPANIES'&amp;gt; C
    where C.K_COMPANY = PC.K_COMPANY and PC.K_PROJECT=:param1 and PC.MAIN=1&quot;, param1=&quot;#K&quot;, store=&quot;1&quot;)%&amp;gt;
&amp;lt;%RunQuery(id=&quot;MainCont&quot;, SQL=&quot;select C.K_CONTACT, C.NAME, C.MIDDLENAME, C.FIRSTNAME from &amp;lt;#table name='PROJ_CONT'&amp;gt; PC, &amp;lt;#table name='CONTACTS'&amp;gt; C
    where C.K_CONTACT = PC.K_CONTACT and PC.K_PROJECT=:param1 and PC.MAIN=1&quot;, param1=&quot;#K&quot;, store=&quot;2&quot;)%&amp;gt;

&amp;lt;%RunQuery(id=&quot;ListCont&quot;, MASTER=&quot;20&quot;, DETAIL=&quot;11&quot;, param1=&quot;%%GetKey()&quot;, mainquery=&quot;true&quot;)%&amp;gt; ]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We also need to change the &quot;{dropdownKey}&quot; argument passed by our detailMenu (edited before). Efficy know the relation to edit by following this rule : &quot;detailKey_relationKey&quot;. To do this, we'll overload the &quot;MENU&quot; definition, with this new rule : &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MacroConsultCustom :

DetailGridColumns.Proj.Cont     {[MENU{RELATIONMENU},NAME,MIDDLENAME,FIRSTNAME{NAME},PHONE1{PHONE},PHONE2{PHONE},EMAIL1{EMAIL}]}

GridColumnCustom : 

th.RELATIONMENU {[&amp;lt;th class=&quot;icon-cell hide-for-print&quot;&amp;gt; &amp;lt;/th&amp;gt;]}
td.RELATIONMENU {[&amp;lt;td class=&quot;menu icon-cell hide-for-print&quot;&amp;gt;&amp;lt;span class=&quot;dropdown no-pip i-menu small&quot; hello data-dropdown=&quot;detail-menu&quot; data-args=&quot;&amp;lt;#F=K_CONTACT;context=ATTR&amp;gt;_&amp;lt;#F=K_RELATION;context=ATTR&amp;gt;&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;]} 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, ... it is done ! You'll be able to Edit the relation between project and contact, starting from the project. In my specific case it wasn't asked to do it starting from the contact itself but it wouldn't be hard to modify.&lt;/p&gt;

&lt;p&gt;I hope it help you in the future, &lt;/p&gt;

&lt;p&gt;Loïc&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3969/solution-relation-krelation-between-entities-krelation</guid>
<pubDate>Tue, 19 Feb 2019 19:32:31 +0000</pubDate>
</item>
<item>
<title>New Etity Relation : error Unknow EntityView &quot;&quot;</title>
<link>https://overflow.efficy.io/?qa=3825/new-etity-relation-error-unknow-entityview</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I have a custom entity 'Missions', this entity use the PRODUCTS table too&lt;br&gt;
FAMILY  =  1 ==&amp;gt; Missions&lt;br&gt;
FAMILY &amp;lt;&amp;gt; 1 ==&amp;gt; Products&lt;/p&gt;

&lt;p&gt;My problem : When I want to add / delete a relation between a Mission and an other entity I have this error:&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=1250673765610111573&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;

&lt;p&gt;It works if I customize CreateRelation(), EditRelation(), DeleteLink() in Custom.js to  replace 'Miss' by 'Prod' like this :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function DeleteLink(Bookmark, Entity, Key, Detail, DetailKey, ItemName, NoConfirm) {
    if (! NoConfirm) {
        var Msg = sRelDelConfirm
        if (ItemName) Msg = sRelDelConfirmName + ItemName + &quot;' ?&quot;
        if (! confirm(Msg)) return
    }

    if(Entity=='Miss') Entity='Prod' // FORCE MISSIONS TO PRODUCTS
    var URL = &quot;deletelink?bookmark=&quot; + Bookmark + &quot;&amp;amp;entity=&quot; + Entity + &quot;&amp;amp;key=&quot; + Key + &quot;&amp;amp;detail=&quot; + Detail + &quot;&amp;amp;detailkey=&quot; + DetailKey
    LocationSet(window, URL, true)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;How to indicate to Efficy which EntityView use ?&lt;/p&gt;

&lt;p&gt;Systems table for Missions :&lt;br&gt;
&lt;strong&gt;SYS_ENTITIES&lt;/strong&gt;&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=8760125147011586048&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;
&lt;strong&gt;SYS_ENTITYVIEWS&lt;/strong&gt;&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=9446429460873961172&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3825/new-etity-relation-error-unknow-entityview</guid>
<pubDate>Mon, 07 Jan 2019 17:22:18 +0000</pubDate>
</item>
<item>
<title>avoid relation cont-comp modification</title>
<link>https://overflow.efficy.io/?qa=3386/avoid-relation-cont-comp-modification</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I try to avoid the modification of a main relation using workflow and I get troubles:&lt;br&gt;
  With the code below when I try to modify or delete relation by edit relation on contact THIS WORK&lt;br&gt;
but when I edit contact and change/delete on the right side the company link nothing is trigger and the link is change ???&lt;/p&gt;

&lt;p&gt;How can I avoid the fact that the relation can be change on edit contact ?&lt;/p&gt;

&lt;p&gt;Best regards.&lt;/p&gt;

&lt;p&gt;here is my code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function BeforeCommitContComp(EditHandle, Inserted) {
    log(&quot;beforeCommitContComp&quot;);
    var 
        ContCompDataSet = EfficyAPI.GetMasterDataSet(EditHandle, 0),
        ContKey = ContCompDataSet.FieldByName('K_CONTACT').AsFloat,
        ContMain = ContCompDataSet.FieldByName('MAIN').AsString;
    if(IsMainComp(ContKey) &amp;amp;&amp;amp; ContMain == '0') {
        log(&quot;Vous ne pouvez pas changer la relation entre ce contact et une société mère ! k-contact=&quot; + ContKey);
        throw new Error(&quot;You can't change relation between this contact and main company!&quot;);
    }
}

function OnBeforeDeleteContComp(Key, DetailKey) {
    log(&quot;OnBeforeDeleteContComp&quot;);
    if(IsMainComp(Key)) {
        log(&quot;Vous ne pouvez pas effacer le lien avec une société mère ! k_contact=&quot; + Key);
        throw new Error(&quot;You can't delete relation with a main company!&quot;);
    }
}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Efficy Partners</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3386/avoid-relation-cont-comp-modification</guid>
<pubDate>Tue, 10 Jul 2018 12:32:19 +0000</pubDate>
</item>
<item>
<title>Error on editing cont_comp relation</title>
<link>https://overflow.efficy.io/?qa=3365/error-on-editing-contcomp-relation</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;We got a strange problem on the crm when editing a cont_comp relation with a custom fields added. When on a contact consult screen tab company if we try to modify relation everything is okay. But for the same contact in edit form screen when we want to modify the company relation an error occur (see screenshot). We try with no custom and we got the same error, so we know that came from database but we don't know where to fixe it.&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=14565227782382637604&quot; alt=&quot;error editing relation&quot;&gt;&lt;/p&gt;
</description>
<category>Efficy Partners</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3365/error-on-editing-contcomp-relation</guid>
<pubDate>Tue, 03 Jul 2018 15:59:11 +0000</pubDate>
</item>
<item>
<title>How to insert a project and link it to a company</title>
<link>https://overflow.efficy.io/?qa=3184/how-to-insert-a-project-and-link-it-to-a-company</link>
<description>&lt;p&gt;Hi everyone.&lt;/p&gt;

&lt;p&gt;Im working on a method with the C# proxy for add 377 projects with the same Name (Reporting)&lt;/p&gt;

&lt;p&gt;and link it to a company with the efficyKey.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;here is my code : 

 try
        {
            List&amp;lt;Company&amp;gt; Companies = GetAllCompanies();
            Companies = Companies.Where(a =&amp;gt; a.TypeRelation == CompRelationType.Participee || Convert.ToInt32(a.TypeRelation) == 9).Select(a =&amp;gt; a).ToList();

            TContextHandle EditContext;

            foreach (var Iterator in Companies)
            {
                EditContext = Proxy.OpenEditContext(&quot;PROJ&quot;, 0);

                Hashtable Fields = new Hashtable();
                Fields.Add(&quot;NAME&quot;, &quot;Reporting&quot;);

                Proxy.UpdateFields(EditContext, Fields);

                TContextHandle EditDocuProd = Proxy.OpenEditContextRelation(&quot;PROJ&quot;, EditContext.Key, &quot;COMP&quot;, Iterator.EfficyKey, -1);
                Proxy.CloseContext(EditDocuProd);
            }
        }
         catch(Exception E)
        {
            DisposeProxy();
            Helper.LogHelper.LogMessage(Helper.LogHelper.MessageType.Error, &quot;Error EfficyDataLayer.AddDossierForSoc()&quot;);
            Helper.LogHelper.LogExceptionMessage(E);
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I got an error after the CloseContext because the project is not link to any company.&lt;/p&gt;

&lt;p&gt;Do u have the right method to do that ?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

&lt;p&gt;Vessiere Thomas.&lt;/p&gt;
</description>
<category>Remote API (JSON, SOAP, Node)</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3184/how-to-insert-a-project-and-link-it-to-a-company</guid>
<pubDate>Fri, 25 May 2018 13:31:18 +0000</pubDate>
</item>
<item>
<title>Ancestors and descendants hierarchy in a relation table (SQL Server)</title>
<link>https://overflow.efficy.io/?qa=2889/ancestors-and-descendants-hierarchy-relation-table-server</link>
<description>&lt;pre&gt;&lt;code&gt;-- Get all descendant products given a parent product key
DECLARE @parentProductKey float = 200539; 
WITH PROD_HIERARCHY
AS
(
       SELECT DISTINCT
             PP1.K_PRODUCT K_PRODUCT_PARENT,
             PP1.K_PRODUCT2 K_PRODUCT_DESCENDANT
       FROM PROD_PROD PP1
             LEFT JOIN PROD_PROD PP2 ON PP1.K_PRODUCT2 = PP2.K_PRODUCT
       WHERE PP1.K_PRODUCT = @parentProductKey
       UNION ALL
       SELECT
             H.K_PRODUCT_PARENT,
             PP.K_PRODUCT2
       FROM PROD_HIERARCHY H
             INNER JOIN PROD_PROD PP ON H.K_PRODUCT_DESCENDANT = PP.K_PRODUCT
)
SELECT * FROM PROD_HIERARCHY

-- Get all ancestor products given a descendant product key
DECLARE @descendantProductKey float = 202099; 
WITH PROD_HIERARCHY AS
(
    SELECT  K_PRODUCT2 K_PRODUCT_DESCENDANT, 
            K_PRODUCT K_PRODUCT_PARENT 
    FROM    PROD_PROD
       WHERE K_PRODUCT2 = @descendantProductKey
    UNION ALL
    SELECT  PP.K_PRODUCT2, 
            PP.K_PRODUCT 
    FROM    PROD_PROD PP
            INNER JOIN PROD_HIERARCHY H ON H.K_PRODUCT_PARENT = PP.K_PRODUCT2
)
SELECT * FROM PROD_HIERARCHY
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Database</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2889/ancestors-and-descendants-hierarchy-relation-table-server</guid>
<pubDate>Wed, 17 Jan 2018 11:07:46 +0000</pubDate>
</item>
<item>
<title>Filed Modified on relation prod_oppo</title>
<link>https://overflow.efficy.io/?qa=2529/filed-modified-on-relation-prodoppo</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;Is there a way to use FiledModified method to know if field like PRICE has been changed on relation prod_oppo?&lt;/p&gt;

&lt;p&gt;Thank you in advance for your help.&lt;/p&gt;

&lt;p&gt;Best Regards.&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2529/filed-modified-on-relation-prodoppo</guid>
<pubDate>Wed, 07 Jun 2017 10:49:39 +0000</pubDate>
</item>
<item>
<title>Efficy 2014 - Where is the little pencil on Docu_Prod ?</title>
<link>https://overflow.efficy.io/?qa=219/efficy-2014-where-is-the-little-pencil-on-docuprod</link>
<description>&lt;p&gt;Dear all,&lt;/p&gt;

&lt;p&gt;Before in Efficy 2012 when we add a panel in a relation table (from conficy) a little pencil displayed automatically in Efficy and when the user clicked on it, all the fields in the pannel was editable. (for instance in the Documents on the product lines)&lt;/p&gt;

&lt;p&gt;For Efficy 2014, the products line are also available in Opportunities, but I could not find this features.&lt;/p&gt;

&lt;p&gt;Do we still have such feature in Efficy 2014 ?&lt;/p&gt;

&lt;p&gt;if so, how can I display it ?&lt;/p&gt;

&lt;p&gt;Best Regards,&lt;br&gt;
Stéphane RONCIN&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=219/efficy-2014-where-is-the-little-pencil-on-docuprod</guid>
<pubDate>Tue, 17 Feb 2015 21:00:18 +0000</pubDate>
</item>
</channel>
</rss>