How to display record in custom created related list of all users having same manager in servicenow - servicenow

I want to display the record in custom created related list of all users having saming manager in servicenow. For e.g. Abel, Jack has manager Adel, so when I open Adel record I should be able to see the Abel user and Jack user.
This is the script I used and don't know how it will execute in related list:
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name','abel');
gr.query();
gr.next();
gs.print(gr.getDisplayValue('manager'));
I tried this is in Scripts Background option in Application Navigator

You shouldn't need to code for this. If you want to add a related list of user's the current user manages. It will list as "Users" but you can change that label in the related list configuration.
If you meant to do this by code, you'd need to a scripted relationship the data. Here's some information on that. https://docs.servicenow.com/bundle/newyork-platform-user-interface/page/administer/form-administration/task/t_CreateDefinedRelatedLists.html

Related

Slack API interactive message menu, select subset of users

I'm currently developing an interactive message menu that prompts users to select another user in their Slack group. Following this guide I am able to prompt the user to select one user from the entire list of users in the group.
I would like to know if it's possible to limit the size of the list to n specific users? If not, is it possible to set the order of users or at least shuffle them randomly? I should be able to do this using data_source: external but would like to know if this can be achieved more elegantly using data_source: users.
No, if you want to show only a subset of users you have two options.
provide the list through an external data
create the list on the fly as a "Simple Menu", with the sub-set of
users, e.g. coming from a request to groups.info with names
added from users.list.

MS CRM Online Custom View - Need to show specific records in View for specific users (based on team)

I have entity "Work Order" for which I have defined many custom views. Work Orders can have records with statuses as "active ,cancelled, closed, inprogress, submitted" etc. My requirement is - currently logged in user who belongs to a specific team "sales representative" should be able to see all records on view.This can be done easily, but If current logged in user does not belongs to "sales representative" team, she should not be able to see "cancelled" records on view but all other record should be visible to her. How can I achieve this using custom filters if it is possible? Or by code changes?
It is possible to do this with custom code. Without questioning the "why" you'd like to do this (possibly it's sensitive information or something?), you can achieve it using a RetrieveMultiple plugin registered on the pre-operation event. Within this plugin one of the input parameters passed in is called "Query" and will have a QueryExpression. You can simply add a filter to this query in the plugin and the relevant rows will be filtered out. Something like this:
var query = (QueryExpression)context.InputParameters["Query"];
var condition= new ConditionExpression()
{
AttributeName = "statuscode",
Operator = ConditionOperator.NotIn,
Values = { 2, 3 } // Or whatever codes you want to filter!
};
query.Criteria.AddCondition(condition);
To check the current user you can grab the user id from the plugin context and retrieve the necessary info you would like to check.
Doesn't sound like this is possible with advanced find alright. You may be able to achieve it using security roles though. If you could assign cancelled work orders to a specific team, and then organise your security setup so that users who are not sales representatives can't see work orders from that specific team, then it might work. Unfortunately you would have to reassign the cancelled work orders which is not always an option.
Otherwise, you might have to go with a separate view for cancelled work orders, out of the box advanced find should allow you present a blank grid of you are not on the right team. But now obviously you are not presenting a whole view of the work orders.
In general I would go with the security option, and just make it work. Any other option is just a stop-gap. Users can always create custom views, so if you don't lock down access using security roles, the data is still accessible in indirect ways.

How can I get userdefined fields on Microsoft Outlook Tasks to be shared exactly as they are on my screen?

I am trying to create a to do list for my team of what all is needing to be done and so that they can assign themselves to each particular task. I am doing all this as a task in microsoft outlook. In order to do this I had to create two additional columns for that were user defined to have them type stuff in. However, when I go to share the to do list with my team the only thing that is showing are the original column fields not the user defined column fields that I created that are editable. How can I get the user definied columns to show up on the peoples tasks list I am sharing this with? Thanks
You need to modify the folder view to show these columns.

How to implement only one user can access a certain the page - MVC 3

I have a page for editing product details. I want to restrict that only one user can edit the product page. When a new user opens it while there is a current user editing it, I would like to place some notification then automatically make it available once the current user leaves the page. Any suggestion on how I should approach this?
I would recommend just letting them both edit at the same time.
If you want to notify the last person to save their document, then you can add a "version" column to the database.
Upon saving, you would check the version column, to ensure that the row had not been changed. If it had been changed, you would notify the user at that point.
If i understand you question correctly it sounds like you need to know about database concurrency,
Here are a couple of articles:
MSDN
Ironspeed
Now if you are asking how to authorize only a single user to edit records then you would need to look at roles and aloow say only admins to edit records.
you can have optimistic lock on your record while it is in edit mode , once it is saved make that record avaliable for other user.
Try something like this:
Create a table something like userAccess with IsAccessColumn
if user 1 access edit page set isAccess to True
So the second user will not access the edit page if records is set to true.
Then Set to False if user 1 finally edited the record
After that user 2 can now open edit page.
Regards

Restrict manager to only see list items created by their employees in SharePoint 2010

I am using a SP2010 custom list as a weekly time sheet for an organization of about 50 employees and 8 managers to use. To create an item, an employee enters client, project, activity type, week ending, and hours in the default view. Now I want to create another view that is restricted to managers. Ideally, I want SP2010 to know who the manager is, and restrict the items they can see to be only those items created by their employees.
I tried the following with no luck.
There is a user information list created by IT that includes all the members of my organization. I added the Manager's Name to every item.
I re-purposed the Modified By column appeared in my custom list when I created that list.
Specifically, I renamed the Modified By column which is a Person or Group type to Manager's Name and changed the value of Show Field: to Manager's Name. I would have rather not done it this way, but I couldn't figure out how I add a list column that is a Person or Group type, and allows you to pick a column to populate with the value I needed.
I saved the view settings and I could see the Manager's Names in the first column for their specific employees. So far so good!
Then I re-edited the view and created a filter that shows items when Manager's Name is equal to [ME].
I saved the view setting and this time I could not see any employee list items which made sense since I am not a people manager.
I had a colleague who is a people manager try it out and he saw no items for his employees, yet I know there are a dozen or so, and they showed up in #4.
I changed the filter to look for his name specifically, and he still could not see his employees, although I could.
So I figured it must be a permission level issue since his permission level was Contribute and mine is Full Control.
I bumped him up to Design level, and he could see his employees as long as I hard-coded his name in the filter for the view.
Do someone knows how to do this easily?
From what I have learnt, there are differences in creating lists and libraries.
A library does not seem to have the functionality displaying group fields in the correct format, whereas a list does. So if you want to create a view for managers / employees then you need to do it in a list, with the manager and employee both as columns in the view.
Just ensure that the employees and managers do not have access to edit their views.

Resources