<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Action Assignment Implemented as Client Script in Next Experience forum</title>
    <link>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2574614#M1591</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can call Server Side Script from Action assignment.&lt;/P&gt;
&lt;P&gt;Make sure your Script include is client callable and you are passing correct function name.&lt;/P&gt;
&lt;P&gt;You can check OOB Action assignments calling GlideAjax. Try adding some logs in your Client side script and make sure it is reaching GlideAjax part.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try commenting some initial lines and see if any API is not supported gere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below OOB actions is using glideAjax, that means it is supported.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-05-30 at 5.58.14 PM.png" style="width: 999px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/264289iC44972B996CA56BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-05-30 at 5.58.14 PM.png" alt="Screenshot 2023-05-30 at 5.58.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 May 2023 12:32:01 GMT</pubDate>
    <dc:creator>Anil Lande</dc:creator>
    <dc:date>2023-05-30T12:32:01Z</dc:date>
    <item>
      <title>Action Assignment Implemented as Client Script</title>
      <link>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2574546#M1590</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;has anyone played with Action Assignments implemented as a Client Script? I am trying to create a list action (to update records on list) using g_modal.showFields. Yet, I am having a problem with calling Ajax script from the client script (it looks like it is not running at all).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run the ajax call at the beginning of the script (I need to fetch some values from server to be placed as options on modal) - in this case modal is loaded but script include is not triggered (all the script include does for the moment is printing info to logs to verify it is triggered).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also trying to call it after after modal confirmation ( inside ".then(function(fieldValues) {}');&lt;/P&gt;&lt;P&gt;) - in this case nothing happens when clicking the button on the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing? Or is it not possible to call server from Action Assignment implemented as Client Script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Action Assignment config:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_1.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/264272iB48C8E46C7469414/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot_1.png" alt="Screenshot_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Client Script:&lt;/P&gt;&lt;DIV&gt;function onClick() {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; var checked = g_list.getChecked();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; var rowsArray = new Array();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; rowsArray = checked.split(",");&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; var ga = new GlideAjax("sn_customerservice.CSMAjaxUtils");&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; ga.addParam("sysparm_name", "testFunction");&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; ga.addParam("sysparm_case_id", 'd0e4a02e87f9a190a94feb509bbb358e');&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; //closeDialog();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; var response = ga.getXML(ajaxResponse);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; function ajaxResponse(serverResponse) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; var fields = [{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type: 'textarea',&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name: 'work_notes',&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; label: getMessage('Resolution notes'),&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mandatory: true&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type: 'choice',&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name: 'causing_party',&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; label: getMessage('Causing party'),&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value: getMessage(' -- Select -- '),&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; choices: [{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; displayValue: 'Duplicate',&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value: 'duplicate'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; displayValue: 'Canceled',&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value: 'canceled'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ],&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mandatory: true&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; ];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; g_modal.showFields({&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; title: "Enter your reason",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fields: fields,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; size: 'lg'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; }).then(function(fieldValues) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; });&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 May 2023 11:49:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2574546#M1590</guid>
      <dc:creator>Daniel67</dc:creator>
      <dc:date>2023-05-30T11:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Action Assignment Implemented as Client Script</title>
      <link>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2574614#M1591</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can call Server Side Script from Action assignment.&lt;/P&gt;
&lt;P&gt;Make sure your Script include is client callable and you are passing correct function name.&lt;/P&gt;
&lt;P&gt;You can check OOB Action assignments calling GlideAjax. Try adding some logs in your Client side script and make sure it is reaching GlideAjax part.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try commenting some initial lines and see if any API is not supported gere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below OOB actions is using glideAjax, that means it is supported.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-05-30 at 5.58.14 PM.png" style="width: 999px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/264289iC44972B996CA56BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-05-30 at 5.58.14 PM.png" alt="Screenshot 2023-05-30 at 5.58.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 12:32:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2574614#M1591</guid>
      <dc:creator>Anil Lande</dc:creator>
      <dc:date>2023-05-30T12:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Action Assignment Implemented as Client Script</title>
      <link>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2575462#M1598</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you. It helped me, to some extent, as I reviewed all the code again. I found nothing (script include is client callable, no spelling errors, etc.) except that my script include was in scope that is not accessible. I moved the script to Global and now it works, but only partially.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I call the script at the beginning of Client Script - it works perfectly.&lt;/P&gt;&lt;P&gt;But - when I move the same script to '.then' function of g_mode.showFields() (as in any OOB &lt;SPAN&gt;Workspace Client Script where some server side actions are run after user clicks OK button&lt;/SPAN&gt;) then list action button does nothing (except reporting "&lt;EM&gt;Error while running Client Script "GlideScopedScript": TypeError: Cannot read properties of undefined (reading 'apply')&lt;/EM&gt;" in console log).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daniel67_0-1685525624857.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/264494iE88A544466A97006/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daniel67_0-1685525624857.png" alt="Daniel67_0-1685525624857.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What is more, when I remove calling GlideAjax from '.then' function, nothing changes - button still does not react. It works again only after I revert Action Assignment record to previous versions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 09:37:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2575462#M1598</guid>
      <dc:creator>Daniel67</dc:creator>
      <dc:date>2023-05-31T09:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Action Assignment Implemented as Client Script</title>
      <link>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2638802#M1934</link>
      <description>&lt;P&gt;I had the same problem, being unable to call a Script Include, nor from an "Action Assignment" (a List Action), nor from a UI Action (both for Scoped Apps / Workspaces - one button on a record form, the other on the List view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I solved this this way =&amp;gt;&lt;/P&gt;&lt;P&gt;- Providing the whole "API Name" of the Script include into the Ajax Call&lt;/P&gt;&lt;P&gt;- Changing the "&lt;SPAN&gt;Accessible from" field, in the Script include, from "This application Scope only" to "All application scopes".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have no idea why it's working now, because all records (Action assignment, UI action, Script Include) all belong to the same Scoped app.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But well... It seems that the Ajax call was happening in the Global scope, for some reason. Hence, this solution. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 12:37:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2638802#M1934</guid>
      <dc:creator>Rapunzel</dc:creator>
      <dc:date>2023-08-09T12:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Action Assignment Implemented as Client Script</title>
      <link>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2993347#M4021</link>
      <description>&lt;P&gt;Thanks Bro it Worked Beautifully!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 12:54:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/next-experience-forum/action-assignment-implemented-as-client-script/m-p/2993347#M4021</guid>
      <dc:creator>KumarAyush6265</dc:creator>
      <dc:date>2024-07-18T12:54:37Z</dc:date>
    </item>
  </channel>
</rss>

