<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Embedded Script Interoperability</title><link>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>Embedded Script Interoperability</title><link>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability</link><pubDate>Wed, 05 Aug 2020 16:19:47 GMT</pubDate><guid isPermaLink="false">c802b38c-6a65-459b-8477-9ce2990ad471</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability#comments</comments><description>Current Revision posted to Developer Training by Former Member on 08/05/2020 16:19:47&lt;br /&gt;
&lt;p&gt;When executing a [[Scripting|scripted customization]], the [[Widgets|widget]], [[Themes|theme]], or [[Automations|automation]] can execute embedded [[Using Velocity|Velocity (.vm)]] and [[Using Server-side Javascript|Server-side Javascript (.jsm)]] files. These embedded executable scripts can share variables and more but are governed by a few rules.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Basic_Execution" name="Basic_Execution"&gt;&lt;/a&gt;Basic Execution&lt;/h2&gt;
&lt;p&gt;When a script executes an embedded script using &lt;code&gt;core_v2_widget.Execute(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, the following contextual data is available to the executed embedded file:&lt;/p&gt;
&lt;h3&gt;&lt;a id="Local_variables" name="Local_variables"&gt;&lt;/a&gt;Local variables&lt;/h3&gt;
&lt;p&gt;In Velocity,&amp;nbsp;local variables are every variable that&amp;#39;s been set using the &lt;code&gt;#set()&lt;/code&gt; or &lt;code&gt;#store()&lt;/code&gt; directive. In&amp;nbsp;Server-side Javascript, every variable defined on the object represented by &lt;code&gt;this&lt;/code&gt; on the outermost execution context of the script is considered local for interoperability.&lt;/p&gt;
&lt;p&gt;When&amp;nbsp;executing an embedded Server-side JavaScript script from a Velocity script, a variable named &lt;code&gt;$myValue&lt;/code&gt; will be accessible within the Server-side Javascript as &lt;code&gt;this.myValue&lt;/code&gt;. Note that the &lt;code&gt;$&lt;/code&gt; prefix is removed and the variable is available on &lt;code&gt;this&lt;/code&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When executing an embedded Velocity script from a Server-side JavaScript script, a variable &lt;code&gt;this.myValue&lt;/code&gt; (the &lt;code&gt;myValue&lt;/code&gt; variable defined on the outermost execution context, &lt;code&gt;this&lt;/code&gt;) will be available as &lt;code&gt;$myValue&lt;/code&gt; in the Velocity script.&lt;/p&gt;
&lt;p&gt;Local values can be edited in the sub-script and the new values will be reflected in the parent script. See &amp;quot;Changing Execution Parameters&amp;quot; below for a rule that affects changes being propagated back up to the calling script.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Execution_state" name="Execution_state"&gt;&lt;/a&gt;Execution state&lt;/h3&gt;
&lt;p&gt;The execution state of sub-scripts executed via &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt; is preserved when the sub-script is executed. Values such as the contextual user, contextual APIs such as &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; (for Automations), and URL page state information (&lt;code&gt;core_v2_page.QueryString&lt;/code&gt;, etc) are still accessible.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Returning_Complex_Objects" name="Returning_Complex_Objects"&gt;&lt;/a&gt;Returning Complex Objects&lt;/h2&gt;
&lt;p&gt;When returning a result from a Server-side Javascript embedded file executed with &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, a complex object can be returned, for example,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var count = 0;

return {
    name: &amp;#39;Bob McBobberson&amp;#39;,
    next: function() {
        count++;
        return count;
    },
    add: function(a, b) {
        return a + b;
    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This script will return a complex object including a basic value (&lt;code&gt;name&lt;/code&gt;), a function that references a contextual variable (&lt;code&gt;next()&lt;/code&gt;), and a function that takes input and performs an operation (&lt;code&gt;add(a, b)&lt;/code&gt;). The script receiving this object can interact with it, basically creating a custom scripting API. Interaction with complex objects is supported in both Velocity and Server-side Javascript.&lt;/p&gt;
&lt;p&gt;If the script above was saved as &amp;quot;api.jsm&amp;quot;, the following could be done in Velocity:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="velocity"&gt;#set($myApi = $core_v2_widget.ExecuteFile(&amp;#39;api.jsm&amp;#39;))

&amp;lt;p&amp;gt;My name is $myApi.name&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One: $myApi.next()&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Two: $myApi.next()&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One plus Two: $myApi.add(1, 2)&amp;lt;/p&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;or this could be done in Server-side Javascript:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var myApi = core_v2_widget.ExecuteFile(&amp;#39;api.jsm&amp;#39;);

var result = [];
result.push(&amp;#39;&amp;lt;p&amp;gt;My name is &amp;#39;);
result.push(myApi.name);
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;One: &amp;#39;);
result.push(myApi.next());
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;Two: &amp;#39;);
result.push(myApi.next());
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;One plus Two: &amp;#39;);
result.push(myApi.add(1, 2));
result.push(&amp;#39;&amp;lt;/p&amp;gt;&amp;#39;);

return result.join(&amp;#39;&amp;#39;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Both samples would result in the HTML:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="html"&gt;&amp;lt;p&amp;gt;My name is Bob McBobberson&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One: 1&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Two: 2&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One plus Two: 3&amp;lt;/p&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note the rules associated with &amp;quot;Changing Execution Options&amp;quot; below as they affect interaction with complex return values.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Changing_Execution_Options" name="Changing_Execution_Options"&gt;&lt;/a&gt;Changing Execution Options&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt; API includes options to control environmental context when executing the requested embedded script file. These options include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DisableAbuseChecking&lt;/strong&gt;. When set to true, automated abuse checking will be disabled for the script&amp;nbsp;while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableActivityStories&lt;/strong&gt;. When set to true, no activity stories will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableNotifications&lt;/strong&gt;. When set to true, no notifications will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsServiceUser&lt;/strong&gt;. When set to true, the accessing user will be set to the service user for the script while it executes effectively running the script as the service user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsUserName&lt;/strong&gt;. When set, the accessing user will be set to the user with the provided username for the script while it executes effectively running the script as the requested user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If any of these values are different from the current execution options (the script calling &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt;), some rules are applied to prevent leaking of information from the sub-script, specifically:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Edits to local variables made within the sub-script are not applied to the calling script.&lt;/li&gt;
&lt;li&gt;Complex objects returned from the sub-script are read-only, which means properties cannot be set and functions cannot be called.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Scheduled_Execution" name="Scheduled_Execution"&gt;&lt;/a&gt;Scheduled Execution&lt;/h2&gt;
&lt;p&gt;All scripted customizations can make use of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt; to run a sub-script as a background job on the Verint Community job server. When the sub-script is executed, the execution state is fully available, however, any local variables defined in the calling script are not persisted. Instead, it is recommended to provide any non-contextual parameters to the scheduled sub-script via the &lt;code&gt;Parameters&lt;/code&gt; option of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt;. Data provided via the &lt;code&gt;Parameters&lt;/code&gt; option is available to the sub-script using &lt;code&gt;core_v2_widget.GetExecutionParameterValue()&lt;/code&gt; and &lt;code&gt;core_v2_widget.GetExecutionParameterValues()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Executing_Local_Configuration_Property_Templates" name="Executing_Local_Configuration_Property_Templates"&gt;&lt;/a&gt;Executing Local Configuration Property Templates&lt;/h2&gt;
&lt;p&gt;[[Using Dynamic Configuration|Dynamic configuration]] allows scripted components to use custom UI implementations to present configuration properties by assigning the property&amp;#39;s &lt;code&gt;template&lt;/code&gt; attribute to the name of an embedded script file (for example, &lt;code&gt;template=&amp;quot;mycustompropertytemplate.vm&amp;quot;&lt;/code&gt;). When an embedded script is executed as a custom property template, it runs without much of the execution state associated to normal execution. For example, a custom property template within an automation will not have access to &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; and a custom property template within a widget won&amp;#39;t be able to retrieve details about layout placement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: widgets&lt;/div&gt;
</description></item><item><title>Embedded Script Interoperability</title><link>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability/revision/4</link><pubDate>Fri, 28 Jun 2019 15:01:24 GMT</pubDate><guid isPermaLink="false">c802b38c-6a65-459b-8477-9ce2990ad471</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability#comments</comments><description>Revision 4 posted to Developer Training by Ben Tiedt on 06/28/2019 15:01:24&lt;br /&gt;
&lt;p&gt;When executing a [[Scripting|scripted customization]], the [[Widgets|widget]], [[Themes|theme]], or [[Automations|automation]] can execute embedded [[Using Velocity|Velocity (.vm)]] and [[Using Server-side Javascript|Server-side Javascript (.jsm)]] files. These embedded executable scripts can share variables and more but are governed by a few rules.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Basic_Execution" name="Basic_Execution"&gt;&lt;/a&gt;Basic Execution&lt;/h2&gt;
&lt;p&gt;When a script executes an embedded script using &lt;code&gt;core_v2_widget.Execute(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, the following contextual data is available to the executed embedded file:&lt;/p&gt;
&lt;h3&gt;&lt;a id="Local_variables" name="Local_variables"&gt;&lt;/a&gt;Local variables&lt;/h3&gt;
&lt;p&gt;In Velocity,&amp;nbsp;local variables are every variable that&amp;#39;s been set using the &lt;code&gt;#set()&lt;/code&gt; or &lt;code&gt;#store()&lt;/code&gt; directive. In&amp;nbsp;Server-side Javascript, every variable defined on the object represented by &lt;code&gt;this&lt;/code&gt; on the outermost execution context of the script is considered local for interoperability.&lt;/p&gt;
&lt;p&gt;When&amp;nbsp;executing an embedded Server-side JavaScript script from a Velocity script, a variable named &lt;code&gt;$myValue&lt;/code&gt; will be accessible within the Server-side Javascript as &lt;code&gt;this.myValue&lt;/code&gt;. Note that the &lt;code&gt;$&lt;/code&gt; prefix is removed and the variable is available on &lt;code&gt;this&lt;/code&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When executing an embedded Velocity script from a Server-side JavaScript script, a variable &lt;code&gt;this.myValue&lt;/code&gt; (the &lt;code&gt;myValue&lt;/code&gt; variable defined on the outermost execution context, &lt;code&gt;this&lt;/code&gt;) will be available as &lt;code&gt;$myValue&lt;/code&gt; in the Velocity script.&lt;/p&gt;
&lt;p&gt;Local values can be edited in the sub-script and the new values will be reflected in the parent script. See &amp;quot;Changing Execution Parameters&amp;quot; below for a rule that affects changes being propagated back up to the calling script.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Execution_state" name="Execution_state"&gt;&lt;/a&gt;Execution state&lt;/h3&gt;
&lt;p&gt;The execution state of sub-scripts executed via &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt; is preserved when the sub-script is executed. Values such as the contextual user, contextual APIs such as &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; (for Automations), and URL page state information (&lt;code&gt;core_v2_page.QueryString&lt;/code&gt;, etc) are still accessible.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Returning_Complex_Objects" name="Returning_Complex_Objects"&gt;&lt;/a&gt;Returning Complex Objects&lt;/h2&gt;
&lt;p&gt;When returning a result from a Server-side Javascript embedded file executed with &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, a complex object can be returned, for example,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var count = 0;

return {
    name: &amp;#39;Bob McBobberson&amp;#39;,
    next: function() {
        count++;
        return count;
    },
    add: function(a, b) {
        return a + b;
    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This script will return a complex object including a basic value (&lt;code&gt;name&lt;/code&gt;), a function that references a contextual variable (&lt;code&gt;next()&lt;/code&gt;), and a function that takes input and performs an operation (&lt;code&gt;add(a, b)&lt;/code&gt;). The script receiving this object can interact with it, basically creating a custom scripting API. Interaction with complex objects is supported in both Velocity and Server-side Javascript.&lt;/p&gt;
&lt;p&gt;If the script above was saved as &amp;quot;api.jsm&amp;quot;, the following could be done in Velocity:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="velocity"&gt;#set($myApi = $core_v2_widget.ExecuteFile(&amp;#39;api.jsm&amp;#39;))

&amp;lt;p&amp;gt;My name is $myApi.name&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One: $myApi.next()&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Two: $myApi.next()&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One plus Two: $myApi.add(1, 2)&amp;lt;/p&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;or this could be done in Server-side Javascript:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var myApi = core_v2_widget.ExecuteFile(&amp;#39;api.jsm&amp;#39;);

var result = [];
result.push(&amp;#39;&amp;lt;p&amp;gt;My name is &amp;#39;);
result.push(myApi.name);
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;One: &amp;#39;);
result.push(myApi.next());
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;Two: &amp;#39;);
result.push(myApi.next());
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;One plus Two: &amp;#39;);
result.push(myApi.add(1, 2));
result.push(&amp;#39;&amp;lt;/p&amp;gt;&amp;#39;);

return result.join(&amp;#39;&amp;#39;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Both samples would result in the HTML:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="html"&gt;&amp;lt;p&amp;gt;My name is Bob McBobberson&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One: 1&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Two: 2&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One plus Two: 3&amp;lt;/p&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note the rules associated with &amp;quot;Changing Execution Options&amp;quot; below as they affect interaction with complex return values.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Changing_Execution_Options" name="Changing_Execution_Options"&gt;&lt;/a&gt;Changing Execution Options&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt; API includes options to control environmental context when executing the requested embedded script file. These options include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DisableAbuseChecking&lt;/strong&gt;. When set to true, automated abuse checking will be disabled for the script&amp;nbsp;while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableActivityStories&lt;/strong&gt;. When set to true, no activity stories will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableNotifications&lt;/strong&gt;. When set to true, no notifications will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsServiceUser&lt;/strong&gt;. When set to true, the accessing user will be set to the service user for the script while it executes effectively running the script as the service user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsUserName&lt;/strong&gt;. When set, the accessing user will be set to the user with the provided username for the script while it executes effectively running the script as the requested user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If any of these values are different from the current execution options (the script calling &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt;), some rules are applied to prevent leaking of information from the sub-script, specifically:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Edits to local variables made within the sub-script are not applied to the calling script.&lt;/li&gt;
&lt;li&gt;Complex objects returned from the sub-script are read-only, which means properties cannot be set and functions cannot be called.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Scheduled_Execution" name="Scheduled_Execution"&gt;&lt;/a&gt;Scheduled Execution&lt;/h2&gt;
&lt;p&gt;All scripted customizations can make use of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt; to run a sub-script as a background job on the Verint Community job server. When the sub-script is executed, the execution state is fully available, however, any local variables defined in the calling script are not persisted. Instead, it is recommended to provide any non-contextual parameters to the scheduled sub-script via the &lt;code&gt;Parameters&lt;/code&gt; option of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt;. Data provided via the &lt;code&gt;Parameters&lt;/code&gt; option is available to the sub-script using &lt;code&gt;core_v2_widget.GetExecutionParameterValue()&lt;/code&gt; and &lt;code&gt;core_v2_widget.GetExecutionParameterValues()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Executing_Local_Configuration_Property_Templates" name="Executing_Local_Configuration_Property_Templates"&gt;&lt;/a&gt;Executing Local Configuration Property Templates&lt;/h2&gt;
&lt;p&gt;[[Using Dynamic Configuration|Dynamic configuration]] allows scripted components to use custom UI implementations to present configuration properties by assigning the property&amp;#39;s &lt;code&gt;template&lt;/code&gt; attribute to the name of an embedded script file (for example, &lt;code&gt;template=&amp;quot;mycustompropertytemplate.vm&amp;quot;&lt;/code&gt;). When an embedded script is executed as a custom property template, it runs without much of the execution state associated to normal execution. For example, a custom property template within an automation will not have access to &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; and a custom property template within a widget won&amp;#39;t be able to retrieve details about layout placement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Embedded Script Interoperability</title><link>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability/revision/3</link><pubDate>Fri, 28 Jun 2019 15:00:05 GMT</pubDate><guid isPermaLink="false">c802b38c-6a65-459b-8477-9ce2990ad471</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability#comments</comments><description>Revision 3 posted to Developer Training by Ben Tiedt on 06/28/2019 15:00:05&lt;br /&gt;
&lt;p&gt;When executing a [[Scripting|scripted customization]], the [[Widgets|widget]], [[Themes|theme]], or [[Automations|automation]] can execute embedded [[Using Velocity|Velocity (.vm)]] and [[Using Server-side Javascript|Server-side Javascript (.jsm)]] files. These embedded executable scripts can share variables and more but are governed by a few rules.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Basic_Execution" name="Basic_Execution"&gt;&lt;/a&gt;Basic Execution&lt;/h2&gt;
&lt;p&gt;When a script executes an embedded script using &lt;code&gt;core_v2_widget.Execute(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, the following contextual data is available to the executed embedded file:&lt;/p&gt;
&lt;h3&gt;&lt;a id="Local_variables" name="Local_variables"&gt;&lt;/a&gt;Local variables&lt;/h3&gt;
&lt;p&gt;In Velocity,&amp;nbsp;local variables are every variable that&amp;#39;s been set using the &lt;code&gt;#set()&lt;/code&gt; or &lt;code&gt;#store()&lt;/code&gt; directive. In&amp;nbsp;Server-side Javascript, every variable defined on the object represented by &lt;code&gt;this&lt;/code&gt; on the outermost execution context of the script is considered local for interoperability.&lt;/p&gt;
&lt;p&gt;When&amp;nbsp;executing an embedded Server-side JavaScript script from a Velocity script, a variable named &lt;code&gt;$myValue&lt;/code&gt; will be accessible within the Server-side Javascript as &lt;code&gt;this.myValue&lt;/code&gt;. Note that the &lt;code&gt;$&lt;/code&gt; prefix is removed and the variable is available on &lt;code&gt;this&lt;/code&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When executing an embedded Velocity script from a Server-side JavaScript script, a variable &lt;code&gt;this.myValue&lt;/code&gt; (the &lt;code&gt;myValue&lt;/code&gt; variable defined on the outermost execution context, &lt;code&gt;this&lt;/code&gt;) will be available as &lt;code&gt;$myValue&lt;/code&gt; in the Velocity script.&lt;/p&gt;
&lt;p&gt;Local values can be edited in the sub-script and the new values will be reflected in the parent script. See &amp;quot;Changing Execution Parameters&amp;quot; below for a rule that affects changes being propagated back up to the calling script.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Execution_state" name="Execution_state"&gt;&lt;/a&gt;Execution state&lt;/h3&gt;
&lt;p&gt;The execution state of sub-scripts executed via &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt; is preserved when the sub-script is executed. Values such as the contextual user, contextual APIs such as &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; (for Automations), and URL page state information (&lt;code&gt;core_v2_page.QueryString&lt;/code&gt;, etc) are still accessible.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Returning_Complex_Objects" name="Returning_Complex_Objects"&gt;&lt;/a&gt;Returning Complex Objects&lt;/h2&gt;
&lt;p&gt;When returning a result from a Server-side Javascript embedded file executed with &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, a complex object can be returned, for example,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var count = 0;

return {
    name: &amp;#39;Bob McBobberson&amp;#39;,
    next: function() {
        count++;
        return count;
    },
    add: function(a, b) {
        return a + b;
    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This script will return a complex object including a basic value (&lt;code&gt;name&lt;/code&gt;), a function that references a contextual variable (&lt;code&gt;next()&lt;/code&gt;), and a function that takes input and performs an operation (&lt;code&gt;add(a, b)&lt;/code&gt;). The script receiving this object can interact with it, basically creating a custom scripting API. Interaction with complex objects is supported in both Velocity and Server-side Javascript.&lt;/p&gt;
&lt;p&gt;If the script above was saved as &amp;quot;api.jsm&amp;quot;, the following could be done in Velocity:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="velocity"&gt;#set($myApi = $core_v2_widget.ExecuteFile(&amp;#39;api.jsm&amp;#39;))

&amp;lt;p&amp;gt;My name is $myApi.name&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One: $myApi.next()&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Two: $myApi.next()&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;One plus Two: $myApi.add(1, 2)&amp;lt;/p&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;or this could be done in Server-side Javascript:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var myApi = core_v2_widget.ExecuteFile(&amp;#39;api.jsm&amp;#39;);

var result = [];
result.push(&amp;#39;&amp;lt;p&amp;gt;My name is &amp;#39;);
result.push(myApi.name);
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;One: &amp;#39;);
result.push(myApi.next());
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;Two: &amp;#39;);
result.push(myApi.next());
result.push(&amp;#39;&amp;lt;/p&amp;gt;\n&amp;lt;p&amp;gt;One plus Two: &amp;#39;);
result.push(myApi.add(1, 2));
result.push(&amp;#39;&amp;lt;/p&amp;gt;&amp;#39;);

return result.join(&amp;#39;&amp;#39;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note the rules associated with &amp;quot;Changing Execution Options&amp;quot; below as they affect interaction with complex return values.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Changing_Execution_Options" name="Changing_Execution_Options"&gt;&lt;/a&gt;Changing Execution Options&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt; API includes options to control environmental context when executing the requested embedded script file. These options include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DisableAbuseChecking&lt;/strong&gt;. When set to true, automated abuse checking will be disabled for the script&amp;nbsp;while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableActivityStories&lt;/strong&gt;. When set to true, no activity stories will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableNotifications&lt;/strong&gt;. When set to true, no notifications will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsServiceUser&lt;/strong&gt;. When set to true, the accessing user will be set to the service user for the script while it executes effectively running the script as the service user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsUserName&lt;/strong&gt;. When set, the accessing user will be set to the user with the provided username for the script while it executes effectively running the script as the requested user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If any of these values are different from the current execution options (the script calling &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt;), some rules are applied to prevent leaking of information from the sub-script, specifically:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Edits to local variables made within the sub-script are not applied to the calling script.&lt;/li&gt;
&lt;li&gt;Complex objects returned from the sub-script are read-only, which means properties cannot be set and functions cannot be called.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Scheduled_Execution" name="Scheduled_Execution"&gt;&lt;/a&gt;Scheduled Execution&lt;/h2&gt;
&lt;p&gt;All scripted customizations can make use of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt; to run a sub-script as a background job on the Verint Community job server. When the sub-script is executed, the execution state is fully available, however, any local variables defined in the calling script are not persisted. Instead, it is recommended to provide any non-contextual parameters to the scheduled sub-script via the &lt;code&gt;Parameters&lt;/code&gt; option of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt;. Data provided via the &lt;code&gt;Parameters&lt;/code&gt; option is available to the sub-script using &lt;code&gt;core_v2_widget.GetExecutionParameterValue()&lt;/code&gt; and &lt;code&gt;core_v2_widget.GetExecutionParameterValues()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Executing_Local_Configuration_Property_Templates" name="Executing_Local_Configuration_Property_Templates"&gt;&lt;/a&gt;Executing Local Configuration Property Templates&lt;/h2&gt;
&lt;p&gt;[[Using Dynamic Configuration|Dynamic configuration]] allows scripted components to use custom UI implementations to present configuration properties by assigning the property&amp;#39;s &lt;code&gt;template&lt;/code&gt; attribute to the name of an embedded script file (for example, &lt;code&gt;template=&amp;quot;mycustompropertytemplate.vm&amp;quot;&lt;/code&gt;). When an embedded script is executed as a custom property template, it runs without much of the execution state associated to normal execution. For example, a custom property template within an automation will not have access to &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; and a custom property template within a widget won&amp;#39;t be able to retrieve details about layout placement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Embedded Script Interoperability</title><link>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability/revision/2</link><pubDate>Fri, 28 Jun 2019 14:53:48 GMT</pubDate><guid isPermaLink="false">c802b38c-6a65-459b-8477-9ce2990ad471</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability#comments</comments><description>Revision 2 posted to Developer Training by Ben Tiedt on 06/28/2019 14:53:48&lt;br /&gt;
&lt;p&gt;When executing a [[Scripting|scripted customization]], the [[Widgets|widget]], [[Themes|theme]], or [[Automations|automation]] can execute embedded [[Using Velocity|Velocity (.vm)]] and [[Using Server-side Javascript|Server-side Javascript (.jsm)]] files. These embedded executable scripts can share variables and more but are governed by a few rules.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Basic_Execution" name="Basic_Execution"&gt;&lt;/a&gt;Basic Execution&lt;/h2&gt;
&lt;p&gt;When a script executes an embedded script using &lt;code&gt;core_v2_widget.Execute(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, the following contextual data is available to the executed embedded file:&lt;/p&gt;
&lt;h3&gt;&lt;a id="Local_variables" name="Local_variables"&gt;&lt;/a&gt;Local variables&lt;/h3&gt;
&lt;p&gt;In Velocity,&amp;nbsp;local variables are every variable that&amp;#39;s been set using the &lt;code&gt;#set()&lt;/code&gt; or &lt;code&gt;#store()&lt;/code&gt; directive. In&amp;nbsp;Server-side Javascript, every variable defined on the object represented by this on the outermost execution context of the script is considered local for interoperability.&lt;/p&gt;
&lt;p&gt;When&amp;nbsp;executing an embedded Server-side JavaScript script from a Velocity script, a variable named &lt;code&gt;$myValue&lt;/code&gt; will be accessible within the Server-side Javascript as &lt;code&gt;this.myValue&lt;/code&gt;. Note that the &lt;code&gt;$&lt;/code&gt; prefix is removed and the variable is available on &lt;code&gt;this&lt;/code&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When executing an embedded Velocity script from a Server-side JavaScript script, a variable &lt;code&gt;this.myValue&lt;/code&gt; (the &lt;code&gt;myValue&lt;/code&gt; variable defined on the outermost execution context, &lt;code&gt;this&lt;/code&gt;) will be available as &lt;code&gt;$myValue&lt;/code&gt; in the Velocity script.&lt;/p&gt;
&lt;p&gt;Local values can be edited in the sub-script and the new values will be reflected in the parent script. See &amp;quot;Changing Execution Parameters&amp;quot; below for a rule that affects changes being propagated back up to the calling script.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Execution_state" name="Execution_state"&gt;&lt;/a&gt;Execution state&lt;/h3&gt;
&lt;p&gt;The execution state of sub-scripts executed via &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt; is preserved when the sub-script is executed. Values such as the contextual user, contextual APIs such as &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; (for Automations), and URL page state information (&lt;code&gt;core_v2_page.QueryString&lt;/code&gt;, etc) are still accessible.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Returning_Complex_Objects" name="Returning_Complex_Objects"&gt;&lt;/a&gt;Returning Complex Objects&lt;/h2&gt;
&lt;p&gt;When returning a result from a Server-side Javascript embedded file executed with &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, a complex object can be returned, for example,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var count = 0;

return {
    name: &amp;#39;Bob McBobberson&amp;#39;,
    next: function() {
        count++;
        return count;
    },
    add: function(a, b) {
        return a + b;
    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This script will return a complex object including a basic value (&lt;code&gt;name&lt;/code&gt;), a function that references a contextual variable (&lt;code&gt;next()&lt;/code&gt;), and a function that takes input and performs an operation (&lt;code&gt;add(a, b)&lt;/code&gt;). The script receiving this object can interact with it, basically creating a custom scripting API. Interaction with complex objects is supported in both Velocity and Server-side Javascript.&lt;/p&gt;
&lt;p&gt;Note the rules associated with &amp;quot;Changing Execution Options&amp;quot; below as they affect interaction with complex return values.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Changing_Execution_Options" name="Changing_Execution_Options"&gt;&lt;/a&gt;Changing Execution Options&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt; API includes options to control environmental context when executing the requested embedded script file. These options include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DisableAbuseChecking&lt;/strong&gt;. When set to true, automated abuse checking will be disabled for the script&amp;nbsp;while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableActivityStories&lt;/strong&gt;. When set to true, no activity stories will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableNotifications&lt;/strong&gt;. When set to true, no notifications will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsServiceUser&lt;/strong&gt;. When set to true, the accessing user will be set to the service user for the script while it executes effectively running the script as the service user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsUserName&lt;/strong&gt;. When set, the accessing user will be set to the user with the provided username for the script while it executes effectively running the script as the requested user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If any of these values are different from the current execution options (the script calling &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt;), some rules are applied to prevent leaking of information from the sub-script, specifically:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Edits to local variables made within the sub-script are not applied to the calling script.&lt;/li&gt;
&lt;li&gt;Complex objects returned from the sub-script are read-only, which means properties cannot be set and functions cannot be called.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Scheduled_Execution" name="Scheduled_Execution"&gt;&lt;/a&gt;Scheduled Execution&lt;/h2&gt;
&lt;p&gt;All scripted customizations can make use of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt; to run a sub-script as a background job on the Verint Community job server. When the sub-script is executed, the execution state is fully available, however, any local variables defined in the calling script are not persisted. Instead, it is recommended to provide any non-contextual parameters to the scheduled sub-script via the &lt;code&gt;Parameters&lt;/code&gt; option of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt;. Data provided via the &lt;code&gt;Parameters&lt;/code&gt; option is available to the sub-script using &lt;code&gt;core_v2_widget.GetExecutionParameterValue()&lt;/code&gt; and &lt;code&gt;core_v2_widget.GetExecutionParameterValues()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Executing_Local_Configuration_Property_Templates" name="Executing_Local_Configuration_Property_Templates"&gt;&lt;/a&gt;Executing Local Configuration Property Templates&lt;/h2&gt;
&lt;p&gt;[[Using Dynamic Configuration|Dynamic configuration]] allows scripted components to use custom UI implementations to present configuration properties by assigning the property&amp;#39;s &lt;code&gt;template&lt;/code&gt; attribute to the name of an embedded script file (for example, &lt;code&gt;template=&amp;quot;mycustompropertytemplate.vm&amp;quot;&lt;/code&gt;). When an embedded script is executed as a custom property template, it runs without much of the execution state associated to normal execution. For example, a custom property template within an automation will not have access to &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; and a custom property template within a widget won&amp;#39;t be able to retrieve details about layout placement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Embedded Script Interoperability</title><link>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability/revision/1</link><pubDate>Fri, 28 Jun 2019 14:52:49 GMT</pubDate><guid isPermaLink="false">c802b38c-6a65-459b-8477-9ce2990ad471</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/67203/embedded-script-interoperability#comments</comments><description>Revision 1 posted to Developer Training by Ben Tiedt on 06/28/2019 14:52:49&lt;br /&gt;
&lt;p&gt;When executing a [[Scripting|scripted customization]], the [[Widgets|widget], [[Themes|theme]], or [[Automations|automation]] can execute embedded [[Using Velocity|Velocity (.vm)]] and [[Using Server-side Javascript|Server-side Javascript (.jsm)]] files. These embedded executable scripts can share variables and more but are governed by a few rules.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Basic_Execution" name="Basic_Execution"&gt;&lt;/a&gt;Basic Execution&lt;/h2&gt;
&lt;p&gt;When a script executes an embedded script using &lt;code&gt;core_v2_widget.Execute(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, the following contextual data is available to the executed embedded file:&lt;/p&gt;
&lt;h3&gt;&lt;a id="Local_variables" name="Local_variables"&gt;&lt;/a&gt;Local variables&lt;/h3&gt;
&lt;p&gt;In Velocity,&amp;nbsp;local variables are every variable that&amp;#39;s been set using the &lt;code&gt;#set()&lt;/code&gt; or &lt;code&gt;#store()&lt;/code&gt; directive. In&amp;nbsp;Server-side Javascript, every variable defined on the object represented by this on the outermost execution context of the script is considered local for interoperability.&lt;/p&gt;
&lt;p&gt;When&amp;nbsp;executing an embedded Server-side JavaScript script from a Velocity script, a variable named &lt;code&gt;$myValue&lt;/code&gt; will be accessible within the Server-side Javascript as &lt;code&gt;this.myValue&lt;/code&gt;. Note that the &lt;code&gt;$&lt;/code&gt; prefix is removed and the variable is available on &lt;code&gt;this&lt;/code&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When executing an embedded Velocity script from a Server-side JavaScript script, a variable &lt;code&gt;this.myValue&lt;/code&gt; (the &lt;code&gt;myValue&lt;/code&gt; variable defined on the outermost execution context, &lt;code&gt;this&lt;/code&gt;) will be available as &lt;code&gt;$myValue&lt;/code&gt; in the Velocity script.&lt;/p&gt;
&lt;p&gt;Local values can be edited in the sub-script and the new values will be reflected in the parent script. See &amp;quot;Changing Execution Parameters&amp;quot; below for a rule that affects changes being propagated back up to the calling script.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Execution_state" name="Execution_state"&gt;&lt;/a&gt;Execution state&lt;/h3&gt;
&lt;p&gt;The execution state of sub-scripts executed via &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt; is preserved when the sub-script is executed. Values such as the contextual user, contextual APIs such as &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; (for Automations), and URL page state information (&lt;code&gt;core_v2_page.QueryString&lt;/code&gt;, etc) are still accessible.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Returning_Complex_Objects" name="Returning_Complex_Objects"&gt;&lt;/a&gt;Returning Complex Objects&lt;/h2&gt;
&lt;p&gt;When returning a result from a Server-side Javascript embedded file executed with &lt;code&gt;core_v2_widget.ExecuteFile(&amp;#39;FILENAME&amp;#39;)&lt;/code&gt;, a complex object can be returned, for example,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;var count = 0;

return {
    name: &amp;#39;Bob McBobberson&amp;#39;,
    next: function() {
        count++;
        return count;
    },
    add: function(a, b) {
        return a + b;
    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This script will return a complex object including a basic value (&lt;code&gt;name&lt;/code&gt;), a function that references a contextual variable (&lt;code&gt;next()&lt;/code&gt;), and a function that takes input and performs an operation (&lt;code&gt;add(a, b)&lt;/code&gt;). The script receiving this object can interact with it, basically creating a custom scripting API. Interaction with complex objects is supported in both Velocity and Server-side Javascript.&lt;/p&gt;
&lt;p&gt;Note the rules associated with &amp;quot;Changing Execution Options&amp;quot; below as they affect interaction with complex return values.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Changing_Execution_Options" name="Changing_Execution_Options"&gt;&lt;/a&gt;Changing Execution Options&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt; API includes options to control environmental context when executing the requested embedded script file. These options include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DisableAbuseChecking&lt;/strong&gt;. When set to true, automated abuse checking will be disabled for the script&amp;nbsp;while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableActivityStories&lt;/strong&gt;. When set to true, no activity stories will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DisableNotifications&lt;/strong&gt;. When set to true, no notifications will be created by API actions made by the script while it executes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsServiceUser&lt;/strong&gt;. When set to true, the accessing user will be set to the service user for the script while it executes effectively running the script as the service user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RunAsUserName&lt;/strong&gt;. When set, the accessing user will be set to the user with the provided username for the script while it executes effectively running the script as the requested user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If any of these values are different from the current execution options (the script calling &lt;code&gt;core_v2_widget.ExecuteFile()&lt;/code&gt;), some rules are applied to prevent leaking of information from the sub-script, specifically:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Edits to local variables made within the sub-script are not applied to the calling script.&lt;/li&gt;
&lt;li&gt;Complex objects returned from the sub-script are read-only, which means properties cannot be set and functions cannot be called.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a id="Scheduled_Execution" name="Scheduled_Execution"&gt;&lt;/a&gt;Scheduled Execution&lt;/h2&gt;
&lt;p&gt;All scripted customizations can make use of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt; to run a sub-script as a background job on the Verint Community job server. When the sub-script is executed, the execution state is fully available, however, any local variables defined in the calling script are not persisted. Instead, it is recommended to provide any non-contextual parameters to the scheduled sub-script via the &lt;code&gt;Parameters&lt;/code&gt; option of &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt;. Data provided via the &lt;code&gt;Parameters&lt;/code&gt; option is available to the sub-script using &lt;code&gt;core_v2_widget.GetExecutionParameterValue()&lt;/code&gt; and &lt;code&gt;core_v2_widget.GetExecutionParameterValues()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Executing_Local_Configuration_Property_Templates" name="Executing_Local_Configuration_Property_Templates"&gt;&lt;/a&gt;Executing Local Configuration Property Templates&lt;/h2&gt;
&lt;p&gt;[[Using Dynamic Configuration|Dynamic configuration]] allows scripted components to use custom UI implementations to present configuration properties by assigning the property&amp;#39;s &lt;code&gt;template&lt;/code&gt; attribute to the name of an embedded script file (for example, &lt;code&gt;template=&amp;quot;mycustompropertytemplate.vm&amp;quot;&lt;/code&gt;). When an embedded script is executed as a custom property template, it runs without much of the execution state associated to normal execution. For example, a custom property template within an automation will not have access to &lt;code&gt;context_v2_automationTrigger&lt;/code&gt; and a custom property template within a widget won&amp;#39;t be able to retrieve details about layout placement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>