Comments on: Client & Server Code in One UI Action https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/ ServiceNow Consulting Scripting Administration Development Tue, 14 May 2024 22:19:57 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Michael https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9889 Mon, 27 Feb 2023 08:58:37 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9889 In reply to Scott.

your tip was the only way I got it to work.

i.e. putting the submit after the client confirmation.
putting the submit in the backend code would invoke the submit even upon opening the record, already, which is too early and “uncontrolled”

]]>
By: Rajneesh Pandey https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9888 Tue, 23 Apr 2019 07:22:49 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9888 its really good to see this article. i have been looking for this action. thank you

]]>
By: Sandeep https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9887 Wed, 05 Dec 2018 20:58:01 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9887 Hi All,

How to make this work on a UI action on related list ? I know that it says explicitly in the beginning that it is for only ‘Form button/Form Context Menu/Form Link’.

I want users to be able to only select one of the related list records, and show them an alert when they select multiple and hit UI action.

Client side of UI action : works fine, and counts the number of records selected and displays alert.
Server Side : loses track of the ‘current’ record it was working on.
After gsftsubmit, record of the main form ( on which related list was) becomes the current record.

Anyone knows a way around that ?

]]>
By: Justin https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9886 Thu, 04 Jan 2018 16:28:26 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9886 Worked perfectly! Thank you, Mark, for providing such great solutions to common problems. Keep up the great work!

]]>
By: MG https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9885 Thu, 09 Nov 2017 22:02:03 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9885 Does this leave the server script open for user manipulation at that point, since it’s now on the client side? Or is the server-version of the code only called on the server side when the button is clicked?

]]>
By: Mark Stanger https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9884 Wed, 26 Apr 2017 17:49:20 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9884 In reply to Jennifer.

Hi Jennifer. Questions like these are probably best asked on the ServiceNow community site. Having said that, your button isn’t appearing because the ‘Condition’ value you have can’t ever evaluate to true (which displays the button).

A condition of ‘current.state == 3 && current.state == 4’ is impossible since the state can’t be both 3 and 4 at the same time. I think instead of ‘and’ you want an ‘or’. Something like this for your condition should work better.

current.state == 3 || current.state == 4

]]>
By: Jennifer https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9883 Wed, 26 Apr 2017 14:34:00 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9883 Hi Mark, I have attempted to use the script provided but it is not working for us, in fact button is no longer showing anymore. I am new to scripting so I think that is the issue for me. Purpose is we have created a new type of task (RDTASK) and the users want a Close Task button in the header. Upon closure there are 5 fields that need to be mandatory before task can be closed. Right now I just have one in the code as I am just trying to get that to work. I am at a loss on how to make this work and would love for some assistance.

]]>
By: Mark Stanger https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9882 Mon, 24 Apr 2017 15:03:57 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9882 In reply to Ashish Nahar.

No. Mobile UI is severely limited in regards to scripting support.

]]>
By: Ashish Nahar https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9881 Sun, 23 Apr 2017 10:31:57 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9881 Does this works even for a mobile UI action

]]>
By: Samiul https://servicenowguru.com/ui-actions-system-ui/client-server-code-ui-action/#comment-9880 Tue, 12 Apr 2016 01:54:17 +0000 https://servicenowguru.wpengine.com/?p=1962#comment-9880 In reply to William.

Hi William,

Did you manage to get any result after running your script?
I noticed that you are trying to run ‘alert’ in server-side, i,e alert(obj.username); alert is run in the client side – you need to use gs.addInfoMessage(obj.username) to get the output.

Regards,
Samiul

]]>