- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:31 AM
Hi Team I kindly need your advice
I am developing a scoped application via Studio say "Data Center".
There I have created few tables and an onSubmit client script that has been developed on a particular table form ,from where a GLideAjax pointing to a script include has been called. (both are defined in the same scope that the application is belonged to )
scoped client script
Much logic not inserted to the call back function as I need to find out if the communication is established between CS and SI thus it sends server responses. I have tested for the server response ( though the code does not reflect it ) as I have passed some dummy string from the server expecting to receive it from client side
configuration of the script include in the scoped app is as beneath
Issue:
When the form is submitted ( not from the Studio) client side code gets executed and the alert check points are reached.
(It goes inside the callback function as well). But the gs.log message of the Script include at line 6 is not executed and can not see any debug message in system logs files (syslog), May be the script include is not reached I guess.
More over nothing is received from server
observations
- The script debugger didn't get triggered even though I have activated the .
How could I bundle the script app so that onsubmit client script communicate with the serverscript in the scoped app?
Even I can not execute the code on scripts-Background as it produces an error :
Evaluator.evaluateString() problem: com.glide.script.fencing.MethodNotAllowedException: Function log is not allowed in scope
Does this means the server side scripts not executed? If so how to over come the situation as I need t retrieve server (table ) value on to client side.
please kindly advice.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:51 AM
Hello,
gs.log is not recommended and does not work in scoped application.
Please use gs.info() for your logging needs.
Please re-run your tests again and double-check your return on your script include that it's actually returning a value.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:51 AM
Hello,
gs.log is not recommended and does not work in scoped application.
Please use gs.info() for your logging needs.
Please re-run your tests again and double-check your return on your script include that it's actually returning a value.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 06:29 AM
Thanks a lot it helped me to catch the bug .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 06:46 AM
Hi
I'm adding the second part of the question as it relates to the above code segment as well.
I have managed to get the server response and my expectation is to set the form field value (cabinet_id) based on the server response.
The Issue I'm facing is that the field 'cabinet_id' is not set even if the beneath code segment within the callback function gets executed (please see the highlighted part of the image)
g_form.setValue('cabinet_id',cabinetIdToAdd);
what I have observed is the value gets written to the field and in the next split of second the field gets overridden.
please kindly advice if there is any foul code or concept within the code.
on submit Client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 11:24 AM
Hello,
One of the main issues here is that you're trying to use GlideAjax within an onSubmit client script. So because it's async, the record goes to be saved and the final result isn't necessarily placed in the field, like you want, and so as the record freshes, the value isn't there (or contains what was there before).
It's recommended to review your process and see if you can adjust to an onChange client script, or...switch this to a before business rule and handle the functionality there (setting the field value onSubmit isn't really a user experience function anyway and so doing it in the client isn't really needed) or...evaluate making your GlideAjax not async (search forums for that as that question gets brought up a lot).
So there's 3 ways to do it, that I listed above.
onChange would be the ideal, if it has to happen in the client otherwise, before BR would be next best.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!