<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged lock</title>
<link>https://overflow.efficy.io/?qa=tag/lock</link>
<description>Powered by Question2Answer</description>
<item>
<title>Lock document based on field value</title>
<link>https://overflow.efficy.io/?qa=3339/lock-document-based-on-field-value</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I'm searching for a way to lock a document based on some value in the document itself, so if this value is 1 the document should be locked (no matter if someone is using it or not), apparently in MacroEdit it's using macro &quot;IfReadOnly&quot; to disable fields and &quot;lock.htm&quot; page to check the locking status using macro &quot;GetLockStatus&quot;, so from where Efficy knows if this document is locked or not? and can we manipulate this process to make it based on 2 criteria only for documents (so if flag value is 1 or another user is editing the document then lock it)&lt;/p&gt;

&lt;p&gt;Thank you for your help and advise in advance.&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=3339/lock-document-based-on-field-value</guid>
<pubDate>Thu, 21 Jun 2018 11:34:53 +0000</pubDate>
</item>
<item>
<title>Lock remains after a CloseContext in serverscripts</title>
<link>https://overflow.efficy.io/?qa=2360/lock-remains-after-a-closecontext-in-serverscripts</link>
<description>&lt;p&gt;Hi again dear community^^, &lt;/p&gt;

&lt;p&gt;I have a serverscript that is run by the user &quot;admin&quot; through the scheduleradmin.exe and that create a company record : &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ec = Database.OpenEditContext(ntComp, 0, false);

            try{
                Database.UpdateFields(ec, 0, VarArrayOf([&quot;NAME&quot;]), VarArrayOf([compName])); 

                Database.CommitChanges(ec, true);

                Database.Log(&quot;created : &quot; + ds.FieldByName(&quot;K_COMPANY&quot;).AsInteger);
            }
            finally{
                Database.CloseContext(ec);
                Database.log('finally');
            }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but right after my code is executed within the lock timeout delay, if I go with my own user on the created company, I have the currently locked record error.&lt;/p&gt;

&lt;p&gt;Is that normal?&lt;/p&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=2360/lock-remains-after-a-closecontext-in-serverscripts</guid>
<pubDate>Wed, 15 Mar 2017 16:12:29 +0000</pubDate>
</item>
</channel>
</rss>