Action Assignment Implemented as Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 04:49 AM
Hello,
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).
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).
I am also trying to call it after after modal confirmation ( inside ".then(function(fieldValues) {}');
) - in this case nothing happens when clicking the button on the list.
What am I missing? Or is it not possible to call server from Action Assignment implemented as Client Script?
Action Assignment config:
Client Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 05:32 AM
Hi,
You can call Server Side Script from Action assignment.
Make sure your Script include is client callable and you are passing correct function name.
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.
Try commenting some initial lines and see if any API is not supported gere.
below OOB actions is using glideAjax, that means it is supported.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 02:37 AM
Hi,
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.
When I call the script at the beginning of Client Script - it works perfectly.
But - when I move the same script to '.then' function of g_mode.showFields() (as in any OOB Workspace Client Script where some server side actions are run after user clicks OK button) then list action button does nothing (except reporting "Error while running Client Script "GlideScopedScript": TypeError: Cannot read properties of undefined (reading 'apply')" in console log).
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.
Any ideas?
Best regards
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 05:37 AM
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.
I solved this this way =>
- Providing the whole "API Name" of the Script include into the Ajax Call
- Changing the "Accessible from" field, in the Script include, from "This application Scope only" to "All application scopes".
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.
But well... It seems that the Ajax call was happening in the Global scope, for some reason. Hence, this solution. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 05:54 AM
Thanks Bro it Worked Beautifully!!