When to use Client Scripts vs UI Policies vs UI Actions vs Business Rules

quiksilver
Mega Guru

Hi Guys,

Just starting to play around with scripts , and was wondering if you can give me a guideline on when is the best time to use Client Scripts or UI policies or UI actions, I'm still at a lost on which one to use .

thanks for your help

quik

6 REPLIES 6

CapaJC
ServiceNow Employee
ServiceNow Employee

My 3-braincell rules of thumb: I use UI Actions only for things I need to happen on the server, like creating/modifying records or redirecting a user to another form or list after submission. UI Actions can operate on the client, but I've not yet found a need to do it.

I use UI Policy for client-side things that UI Policy can do. This excludes onSubmit() actions, and maybe some other things I can't remember that are more complex than UI Policy can do for me.

I use Client Script for all else on the client.


Not applicable

Just to add , I use the UI Policy for the cosmetic issues (hide fields / compulsory etc) rather than adding in Client Scripts (although they can be). This is purely an administrative thing so I know where the basic cosmetic changes can be found (rather than trawling scripts).

As stated the UI Actions are used for actions against the "lists" generally, or thats How I use them.
i.e We have a popup window asking for some values which performs an action against all records selected.

Client Scripts are for everything else you need to be interactive with the User, as outlined


thanks for your help guys...

to be clear , i'll give examples of scenarios , kindly answer which one should I use

1. Making a field visible or not depending on a value of another field.
2. Making a warning that the user is submitting a priority 1 incident.
3. Making a value of field react to another field ( i.e. location should be filled up after selecting caller id)
4. Making an alert popup or messagebox informing the service desk that an incident is about to reach 100% of its SLA, so they can do appropriate actions.
5. Making a field change color depending on a value of another field.
6. Making followup on pending approval after a set time.

thanks in advance

Cheers!

quik


Kiwipedro
Mega Contributor

Hi Sheppie - I'm interested in your comment about UI actions, specifically "We have a popup window asking for some values which performs an action against all records selected."

We've got an serious issue with locations due to the limitations of the product out of the box. For our Locations the key field is a site code, rather than the name of site (so rather than "Head Office London" the code is "i002").

In our change request form we have added a "list" box (under Personalize Form) so the submitter and authorisers can add a list of locations that will affected by the change.

So far so good, except when you look up the location and click on the "Site Name", it displays the site code and not the full site name in the box. We want to display the full name, but SNC say its not possible because the Slush bucket only displays the primary key.

My idea is a script to run OnChange that looks up the Site Code and returns the Site Name from the locations table, into a nearby dialog/list box. Don't really want to re-engineer the way we use the locations code. Is this similar to what you have achieved?

Thanks
Kp