<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged workflowscript</title>
<link>https://overflow.efficy.io/?qa=tag/workflowscript</link>
<description>Powered by Question2Answer</description>
<item>
<title>How to queue a function call in a workflow script to execute it async?</title>
<link>https://overflow.efficy.io/?qa=7205/how-to-queue-function-call-in-workflow-script-execute-async</link>
<description>&lt;p&gt;Hi, &lt;/p&gt;

&lt;p&gt;I am working on an integration with Efficy and Exact. One of the flows i need to implement is uploading invoices from exact to Efficy as an attachment. I currently put it in a workflow function and it works fine. However, this flow is very slow (multiple calls to exact so can't make it faster)  and is blocking the end user from doing anything for 20-30 seconds. Is there a way without using schedulers to execute this flow in an async way? A bit like queueing that the  function should be executed in the background. &lt;br&gt;
Or is the only solution using a scheduler service and just use a small time interval? &lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=7205/how-to-queue-function-call-in-workflow-script-execute-async</guid>
<pubDate>Wed, 12 Nov 2025 08:29:40 +0000</pubDate>
</item>
<item>
<title>Syntax for function OnAddLinkOppoPubl(Key, DetailKey)</title>
<link>https://overflow.efficy.io/?qa=7172/syntax-for-function-onaddlinkoppopubl-key-detailkey</link>
<description>&lt;p&gt;Hi,&lt;br&gt;
What is the syntax using the function OnAddLinkOppoPubl(Key, DetailKey) ?&lt;br&gt;
I just want to update the STATUS field of the opportunity after adding a link from the publication to the opportunity.&lt;br&gt;
Thank you&lt;br&gt;
Dimitri&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=7172/syntax-for-function-onaddlinkoppopubl-key-detailkey</guid>
<pubDate>Tue, 22 Apr 2025 10:17:09 +0000</pubDate>
</item>
<item>
<title>How do I know if an email is blocked in SYS_MAILS because of an incorrect address?</title>
<link>https://overflow.efficy.io/?qa=6773/how-know-email-blocked-sysmails-because-incorrect-address</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;How do I ensure that the sending of emails stored in SYS_MAILS continues to be sent when an email address in the batch is incorrect?&lt;/p&gt;

&lt;p&gt;In previous versions, all emails left, even if an address was wrong.&lt;/p&gt;

&lt;p&gt;In the logs, we see that Efficy has detected that an address is wrong but noboby is informed and the mailings are blocked.&lt;/p&gt;

&lt;p&gt;What is the solution?&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

&lt;p&gt;Dimitri&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=6773/how-know-email-blocked-sysmails-because-incorrect-address</guid>
<pubDate>Mon, 05 Dec 2022 16:48:21 +0000</pubDate>
</item>
<item>
<title>In the workflow, is is possible to interact when generating a .pdf file from a .docx file ?</title>
<link>https://overflow.efficy.io/?qa=6760/workflow-possible-interact-generating-file-from-docx-file</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;The .docx file is markedup as an &quot;FACTURE&quot; in a custom column named &quot;TYPE&lt;em&gt;DOCUMENT&quot;.&lt;br&gt;
When creating a .pdf file from this .docx file, I need to markup this .pdf file in the same column named &quot;TYPE&lt;/em&gt;DOCUMENT&quot; with  &quot;FACTURE&quot;.&lt;br&gt;
How can I do this ?&lt;br&gt;
Does it exist a JS function like &quot;OnCreatingPdfFile&quot; ?&lt;br&gt;
Thank you&lt;br&gt;
Dimitri&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=6760/workflow-possible-interact-generating-file-from-docx-file</guid>
<pubDate>Mon, 14 Nov 2022 10:06:25 +0000</pubDate>
</item>
<item>
<title>Efficy.currentUserCode() is returning email address</title>
<link>https://overflow.efficy.io/?qa=6269/efficy-currentusercode-is-returning-email-address</link>
<description>&lt;p&gt;Customer reports:&lt;br&gt;
Efficy.currentUserCode() is returning email address&lt;/p&gt;

&lt;p&gt;When renaming a document name by workflow script a usercode is wanted as part of the documents name. &lt;br&gt;
But the email address of the current user is returned.&lt;/p&gt;

&lt;p&gt;By the way, I can not reproduce this issue. Debugging does not provide any answers.&lt;br&gt;
The problem occurred after upgrading to Efficy 12.0&lt;/p&gt;

&lt;p&gt;Anyone a clue?&lt;br&gt;
Efficy (Build 12.0.25231.0 2021-06-25 10:33)&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=6269/efficy-currentusercode-is-returning-email-address</guid>
<pubDate>Wed, 01 Sep 2021 09:39:39 +0000</pubDate>
</item>
<item>
<title>Could we create companies reference using Efficy designer?</title>
<link>https://overflow.efficy.io/?qa=4849/could-we-create-companies-reference-using-efficy-designer</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I want to create a reference for companies, could we use the designer or we should do it using a database workflow?&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;
</description>
<category>Efficy Designer (Conficy)</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4849/could-we-create-companies-reference-using-efficy-designer</guid>
<pubDate>Thu, 03 Oct 2019 10:23:57 +0000</pubDate>
</item>
<item>
<title>How can I generate .PDF from .DOCX attachment in workflow?</title>
<link>https://overflow.efficy.io/?qa=4682/how-can-i-generate-pdf-from-docx-attachment-in-workflow</link>
<description>&lt;p&gt;We want a related .PDF attachment for each .DOCX template generated invoice.&lt;br&gt;
Can we do this in workflow/serverscript?&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4682/how-can-i-generate-pdf-from-docx-attachment-in-workflow</guid>
<pubDate>Mon, 12 Aug 2019 12:05:12 +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>include in serverscripts with this simple trick</title>
<link>https://overflow.efficy.io/?qa=2589/include-in-serverscripts-with-this-simple-trick</link>
<description>&lt;p&gt;Hi guys, &lt;/p&gt;

&lt;p&gt;sometime in serverscripts you can wish to organize your code over several serverscripts like a tools.js library by example.&lt;/p&gt;

&lt;p&gt;in almost cases you can just do the trick from your serverscripts call like : &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;%LoadScript(&quot;mylib1.js;mylib2.js;myscriptfile.js&quot;)%&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;same goes for ajax calls.&lt;/p&gt;

&lt;p&gt;this does not correspond to a real include from a file so we can't just use this trick for scheduler.exe.&lt;/p&gt;

&lt;p&gt;I found a way to make an include like call from a serverscript that works in scheduler as well so please enjoy it (even if the solution is a bit obvious I never thought about that before so...)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var root = &quot;C:/inetpub/wwwroot/customs/mycustom/&quot;;
var dependencies = [
    &quot;serverscripts/mylib1.js&quot;,
    &quot;serverscripts/mylib2.js&quot;
];

for (var i=0; i&amp;lt;dependencies.length; i++){
    eval(StrLoadBinaryFile(root + dependencies[i]));
}

function myFunction(){ //-----(called by the scheduler)
    return functionFromMyLib1(); //-----(definition in mylib1.js)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;since I havn't tested it in a workflow I can only assume that it would do the trick as well.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2589/include-in-serverscripts-with-this-simple-trick</guid>
<pubDate>Fri, 07 Jul 2017 08:05:16 +0000</pubDate>
</item>
<item>
<title>How to get custom f_field with GetDetailDataset in workflow?</title>
<link>https://overflow.efficy.io/?qa=2174/how-to-get-custom-ffield-with-getdetaildataset-in-workflow</link>
<description>&lt;p&gt;I've got the following function in my workflow to automatically define the Name of an opportunity:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
function SetOpportunityName(EditOppo, Inserted){&lt;br&gt;
    var dsOppo = Database.GetMasterDataSet(EditOppo,0);&lt;br&gt;
    dsOppo.Edit;&lt;br&gt;
    var dsComp = Database.GetDetailDataSet(EditOppo, ntComp);&lt;br&gt;
    if (dsComp &amp;amp;&amp;amp; !dsComp.EOF) {&lt;br&gt;
    dsComp.First;&lt;br&gt;
    var opdrachtgever = dsComp.FieldByName('F&lt;em&gt;NAME&lt;/em&gt;KORT').AsString;&lt;br&gt;
    } else {&lt;br&gt;
    var opdrachtgever = 'OPDRACHTGEVER';&lt;br&gt;
    }&lt;br&gt;
    var dienst = Database.GetLookupValueFromKey(22000,'F&lt;em&gt;DIENST',dsOppo.FieldByName('F&lt;/em&gt;DIENST').AsInteger);&lt;br&gt;
    var onderwerp = dsOppo.FieldByName('F&lt;em&gt;ONDERWERP').AsString;&lt;br&gt;
    dsOppo.FieldByName('NAME').AsString = GetDienstAfkorting(dsOppo.FieldByName('F&lt;/em&gt;DIENST').AsInteger) + ' ' + opdrachtgever + ' ' + onderwerp;&lt;br&gt;
}\&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For the var opdrachtgever I want to look up the field F&lt;em&gt;NAME&lt;/em&gt;KORT within companies. This field is present in the database and I also added the field in the sys&lt;em&gt;query 0,10 Linked comp with the following code. &lt;br&gt;
&lt;code&gt;&lt;br&gt;
[Select]&lt;br&gt;
COMPANIES.K&lt;/code&gt;&lt;/em&gt;COMPANY&lt;br&gt;
COMPANIES.NAME&lt;br&gt;
COMPANIES.BUILDING&lt;br&gt;
COMPANIES.CITY&lt;br&gt;
COMPANIES.COUNTRY&lt;br&gt;
COMPANIES.PHONE1&lt;br&gt;
COMPANIES.WEB1&lt;br&gt;
COMPANIES.OPENED&lt;br&gt;
COMPANIES.F&lt;em&gt;NAME&lt;/em&gt;KORT&lt;br&gt;
COMPANIES.MEMO&lt;br&gt;
COMPANIES.MEMOFORMATTED&lt;br&gt;
&amp;lt;#RELATIONTABLE&amp;gt;.&amp;lt;#MASTERKEY&amp;gt; hidden&lt;/p&gt;

&lt;p&gt;[From]&lt;br&gt;
&amp;lt;#RELATIONTABLE&amp;gt;&lt;br&gt;
&amp;lt;#RELATIONTABLE&amp;gt; COMPANIES&lt;/p&gt;

&lt;p&gt;[Where]&lt;br&gt;
&amp;lt;#RELATIONTABLE&amp;gt;.&amp;lt;#MASTERKEY&amp;gt; = 0&lt;/p&gt;

&lt;p&gt;[Orderby]&lt;br&gt;
COMPANIES.NAME&lt;br&gt;
COMPANIES.BUILDING&lt;/p&gt;

&lt;p&gt;[Columns]&lt;br&gt;
MENU,NAME,CITY,R&lt;em&gt;COUNTRY,PHONE1{PHONE},WEB1{WEB},F&lt;/em&gt;NAME_KORT&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Why doesn't this work yet? At the moment I try to add or edit an opportunity I get the following error:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
Error while executing Script &quot;EDatabaseError&quot; at line 41 char 2.&lt;br&gt;
 Message: &quot;DS&lt;em&gt;OppoEdit&lt;/em&gt;2&lt;em&gt;Oppo&lt;/em&gt;Comp: Field 'F&lt;em&gt;NAME&lt;/em&gt;KORT' not found&quot;&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
<category>How to</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2174/how-to-get-custom-ffield-with-getdetaildataset-in-workflow</guid>
<pubDate>Thu, 12 Jan 2017 08:33:42 +0000</pubDate>
</item>
<item>
<title>How to compare old and new value in a workflow</title>
<link>https://overflow.efficy.io/?qa=2165/how-to-compare-old-and-new-value-in-a-workflow</link>
<description>&lt;p&gt;Hi, &lt;/p&gt;

&lt;p&gt;in Efficy 10 SP1 this is my workflow function &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function BeforeCommitActi(EditHandle, Inserted){
var ds = Database.GetMasterDataSet(EditHandle, 0);

var result = &quot;&quot;;

result = &quot;old : &quot; + Database.OldFieldValue(EditHandle, 0, &quot;DURATION&quot;);
result += &quot; - &quot;;
result += &quot;new : &quot; + ds.FieldByName(&quot;DURATION&quot;).AsString;

throw new Error(result);

}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;after modifying an action duration from 3h to 3h30 my error message only contains the old value : &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Message: &quot;old : 10800 - new : 10800&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;How can I access the new one?&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2165/how-to-compare-old-and-new-value-in-a-workflow</guid>
<pubDate>Mon, 09 Jan 2017 09:37:28 +0000</pubDate>
</item>
<item>
<title>OnBeforeDeleteProdProj(key, detailKey, krelation) called with undefined krelation...</title>
<link>https://overflow.efficy.io/?qa=1526/onbeforedeleteprodproj-detailkey-krelation-undefined-krelation</link>
<description>&lt;p&gt;Hi, &lt;br&gt;
I added a K&lt;em&gt;RELATION column to the table &quot;PROD&lt;/em&gt;PROJ&quot;.&lt;/p&gt;

&lt;p&gt;It run well everywhere, except the  &lt;strong&gt;OnBeforeDeleteProdProj(key, detailKey, krelation)&lt;/strong&gt; function, which is call with an undefined value for the &quot;krelation&quot; parameter...&lt;/p&gt;

&lt;p&gt;Where is the problem ?&lt;br&gt;
Thanks&lt;br&gt;
Didier&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=1526/onbeforedeleteprodproj-detailkey-krelation-undefined-krelation</guid>
<pubDate>Mon, 18 Apr 2016 11:44:48 +0000</pubDate>
</item>
<item>
<title>Delete / Overwrite entries in SYS_CHANGED for a single entity</title>
<link>https://overflow.efficy.io/?qa=1251/delete-overwrite-entries-in-syschanged-for-single-entity</link>
<description>&lt;p&gt;Hi all,&lt;/p&gt;

&lt;p&gt;I need to make the data for a single contact anonymous. For reporting purposes we need to keep the data without the personal information. For the entity that's easy, but consequently I have to do this for the changelog also...&lt;/p&gt;

&lt;p&gt;I there a secret efficy function that can handle this?&lt;br&gt;
I'd klike to avoid a direct database operation.&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

&lt;p&gt;Tim  &lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=1251/delete-overwrite-entries-in-syschanged-for-single-entity</guid>
<pubDate>Tue, 19 Jan 2016 12:53:28 +0000</pubDate>
</item>
<item>
<title>Script which checks a date field an send a mail automatically using a template in the template list</title>
<link>https://overflow.efficy.io/?qa=673/script-which-checks-field-automatically-template-template</link>
<description>&lt;p&gt;I need a script that checks a date field, once the period has been arrived, the script should send a mail automatically using a template in the template list to the related person.&lt;/p&gt;

&lt;p&gt;(It can also be used for B-Days)&lt;/p&gt;

&lt;p&gt;Thx,&lt;br&gt;
Can D.&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=673/script-which-checks-field-automatically-template-template</guid>
<pubDate>Wed, 26 Aug 2015 14:10:36 +0000</pubDate>
</item>
<item>
<title>Message: &quot;You cannot edit the parent of a Recurrent Action Series&quot;</title>
<link>https://overflow.efficy.io/?qa=467/message-you-cannot-edit-the-parent-recurrent-action-series</link>
<description>&lt;p&gt;Hello I need to update actions depending on other.&lt;br&gt;
But I got some errors when user created some recurrent actions in my data sync&lt;/p&gt;

&lt;p&gt;It bug when I try to edit : &lt;em&gt;Database.OpenEditContext(Target, Key)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Any idea to edit an action when it's a series ??&lt;br&gt;
I tried DisableSecurity but without success&lt;br&gt;
Here the error.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Error while creating or modifying destination record
Error while executing Script &quot;EActionSeriesParent&quot;
Message: &quot;You cannot edit the parent of a Recurrent Action Series&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=467/message-you-cannot-edit-the-parent-recurrent-action-series</guid>
<pubDate>Tue, 23 Jun 2015 15:42:38 +0000</pubDate>
</item>
<item>
<title>BeforeCommitXXXYYYY in edit context not firing</title>
<link>https://overflow.efficy.io/?qa=391/beforecommitxxxyyyy-in-edit-context-not-firing</link>
<description>&lt;p&gt;BeforeCommitXXXXYYY functions are fired in consult mode only eg linking 2 entities from Consult but not in Edit Mode, as an example : opportunities vs contact role. &lt;br&gt;
Does anyone knows how to make it happens in Edit context ?&lt;br&gt;
Tkx&lt;/p&gt;
</description>
<category>Efficy Developers</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=391/beforecommitxxxyyyy-in-edit-context-not-firing</guid>
<pubDate>Wed, 13 May 2015 06:39:29 +0000</pubDate>
</item>
<item>
<title>Determine K_RELATION of current relation in the workflowscript at OnInsertDetailXXXXYYYY</title>
<link>https://overflow.efficy.io/?qa=208/determine-krelation-workflowscript-oninsertdetailxxxxyyyy</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;is there a way to determine the K_RELATION of the current relation in the function OnInsertDetailXXXXYYYY?&lt;br&gt;
Or is there a way to access the current relation DataSet?&lt;/p&gt;

&lt;p&gt;I ask this question because of the fact that when you use Database.GetMasterDataSet(EditHandle, 0) that you get de DataSet of the XXXX entity and not from the current relation.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Jeroen&lt;/p&gt;
</description>
<category>Efficy Developers</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=208/determine-krelation-workflowscript-oninsertdetailxxxxyyyy</guid>
<pubDate>Fri, 13 Feb 2015 10:48:01 +0000</pubDate>
</item>
</channel>
</rss>