0

I am trying to achieve the following, using the Issue Tracking list inside sharePoint server 2013. First I have an issue item which have the following columns:-

  1. ID.
  2. Title.
  3. Date Created.
  4. Description.
  5. Assigned To Manager.
  6. Type.
  7. Manager Decision.
  8. Manager cost (budget).

All users can create a new issue and enter the basic info such as;

  1. ID.
  2. Title.
  3. Date Created.
  4. Description.
  5. Assigned To Manager.

Then the “Assigned to Manager” will receive an email, open the item, and fill the other fields:-

  1. Type.
  2. Manager Decision.
  3. Manager cost (budget).

So my questions are:-

  1. How I can implement this by dividing the issue item fields into two different Edit forms?
  2. How I can divide the user’s permissions (user and manager) and specify who can add/edit the item data. so only managers can fill the following data; type, manager decision & Manager cost (budget)?

Regards

EDIT

I wrote the following inside VS :-

enter image description here

but i got error on site.Group and other commands , as shown in the above picture.so i think i am missing how i should write the web part ? can you advice what is wrong please?

Edit Two

currently i got the following inside the web part:-

enter image description here

so i am not sure where to add the asp control ?

  • how do you want to achieve this, custom web part would work? – Hardik Kothari Sep 22 '14 at 13:43
  • @HardikKothari can you advice more on using web part in this situation ? i did not work on such a requirement before. but how i think it might work (not sure if this is available within SharePoint ) ; is to have two Forms instead of the default form which contains all the columns , and to define a workflow of two steps, and link each step within the workflow to a form !! can you advice please? – john Gu Sep 22 '14 at 14:52
1

you can try with a approach using custom visual web part where you can show/hide and enable/disable the controls depending on the user permissions (Users,Managers Group) and attach a workflow or c# code for sending the email notification to Manager maintaining a flag on the list item action.

1) Create a custom web part.

2) Add the web part on your edit form using the below option enter image description here

3) Code for your web part:

On PageLoad check for the user group and accordingly display/hide, enable disable the custom controls

using (SPSite site = new SPSite(SPContext.Current.Site.Url))
                using (SPWeb web = site.OpenWeb())
                {SPGroup group = web.Groups["Managers"];
                    bool isUser = web.IsCurrentUserMemberOfGroup(group.ID);
                    if (isUser)
                    {textbox.Visible=false;}}

And on custom buttons Save below code:

ASP Control:

<asp:Button id="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"/>

CS Code:

protected void btnSave_Click(object sender, EventArgs e){
        try
        {
        using (SPSite site = new SPSite(SPContext.Current.Site.Url))
        using (SPWeb web = site.OpenWeb())
        {
                   SPList list = web.Lists["ListName"];
                   web.AllowUnsafeUpdates = true;
                   SPListItem item = list.Items[SPContext.Current.ListItem.UniqueId];
                   txtTitle.Text = item["Title"] as string;
                   item.Update();
                   web.AllowUnsafeUpdates = false;
        }
        }
        catch (Exception ex){}}

This would solve the purpose using single default Edit Form with a custom web part.

Edit : ASCX Control reference enter image description here

  • 1
    yes you can use it that way. for read only you can mention textbox.Enabled=false, this way you can control over users and operations on default form with custom visual web part – Hardik Kothari Sep 22 '14 at 15:26
  • 1
    you can use visual web part (farm) using VS and deploy it onto your server and it will show you under Custom section in the webparts. – Hardik Kothari Sep 22 '14 at 15:32
  • 1
    Please see the edited code. And you can add a asp:button control on visual web part and add the button click event with the code. – Hardik Kothari Sep 23 '14 at 4:34
  • 1
    sorry, use web instead site. – Hardik Kothari Sep 23 '14 at 9:59
  • 1
    check the edited answer – Hardik Kothari Sep 23 '14 at 11:53
1

There are several ways you can achieve it. It depends on how many users you will have accessing the list. On several occasions, I create lists where only a single manager will be accessing the page. Instead of creating separate views, you can control access based on the username.

You can encapsulate the manager only data fields in a section. enter image description here

You will then create a text data field with the formula User(). This will return the username of the individual accessing the form.

enter image description here

After that simply create rule telling the section to hide if a certain username is not returned. So if I wanted to only show this section to myself, I would set to hide the field if my username did not return.

enter image description here

As I stated, however, it completely depends on how many users this is being targeted for.

  • But can i specify the rule to hide the fields is the login user is not inside a certain sharepoint user group ? as currently we have 10 users defined as managers and they can see all fields. but those 10 users might be expanded or reduced .... – john Gu Sep 23 '14 at 11:09
  • This method is only going to return a single user name. It won't be able to tell what groups they belong to. If you have a group that is constantly changing this might not be the best way to achieve your goal. – Zachary Kleemons Sep 23 '14 at 14:18
0

You can use javascript/Jquery to hide control in editform page of list. Whenever user edit an item, hide manager's related field. User querystring and read it to make manager's related field visible. As you may be sending url to your manager in email, include querystring in that url so that only manager related field are visible while rest of fields were hidden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.