- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2014 11:24 AM
What would be the best way to limit field visibility based on the current users location??
It looks like UI Policies only focus around field values which will not work for this.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2014 03:52 PM
Wow, I am sorry. I should have asked how else I can help you. I will write out an example script for you to use.
Business Rule
g_scratchpad.location= gs.getUser().getLocation();
You access business rules and client scripts by right clicking on the top header bar of whatever table/record you're on.
Client Script
function onLoad() {
if (g_scratchpad.location == '4b7c157437d0200044e0bfc8bcbe5df5'){
g_form.setVisible('<field_name>',false);//Use this if you want there to be an empty spot on the record where the field was
//g_form.setDisplay('<field_name>',false);//Use this if you want to have the field's space filled in once hidden
}
}
Client Scripts - ServiceNow Wiki
That link is for how setVisible works.
This may not be everything that you need, but this will get you in the right direction.
Does this help or do you need more detail? My email is casey.stinnett@crossfuze.com if you want to do a Google + hangout and I can help you out some more.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2014 08:33 AM
Alright using ACL's how would I limit the worknotes displaying on the incident form based on the location of the customer? Since the customer is tied to the incident table and the worknotes are part of the Task table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2014 09:15 AM
There is an SN wiki entry on ACLs: http://wiki.servicenow.com/index.php?title=Using_Access_Control_Rules
The scripting you've designated as the correct answer is probably 80% of what you'd need for the ACL(s). As to the task->incident relationship you asked about, the incident table inherits that work notes field. Unless you designate the ACL to act on the 'task' level, it will only affect incident and not other tables/applications.
You'd just choose incident as the table and work notes as the field. Then you would utilize a similar script to the display business rule above to get location, and then determine which locations are allowed to see the field or not.
The reason why I suggested ACL versus a client script or UI policy is simply access. This solution will still allow someone to see the data in a report or the list view. An ACL works on all those levels.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2014 07:25 AM
I haven't used ACL's either, is there a wiki I can used to read up on those as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2014 12:20 PM
They both have the same sysID. as it is the same company only difference is I'm looking towards the current user company and the customer company. I attempted the following script with the same results.
var curloc = gs.getUser().getCompanyID();
var cusloc = caller_id.company;
var sysid = "818c19b66fff55003ac289871e3ee4b1";
if (!((curloc != sysid) && (cusloc == sysid))) {
answer = true;
}else{
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2014 12:34 PM
So it looks like your logic is saying:
If NOT (the current user's company is not sysid) AND (the caller's company IS sysid) then answer = true.
Simplifying, this is the same as saying:
If (the current user's company IS sysid) OR (the caller's company is NOT sysid) then answer = true.
Is that really what you want?
What are the actual conditions when you execute this?