3

Given below my scenario,

I have a list named User Configuration which stores user and country detail

User (People or group field)  |  Country (Dropdown choice field)
----------------------------------------------------------------
User A                        |  Hong Kong
User B                        |  China
User B                        |  Singapore

I have another list named Transactions with below schema

Title (Single line of text)   |  Country (Dropdown choice field)
----------------------------------------------------------------
Aaaaaa                        |  Hong Kong
Bbbbbb                        |  Hong Kong
Cccccc                        |  Singapore
Dddddd                        |  Singapore
Eeeeee                        |  Singapore
Ffffff                        |  China
Ggggggg                       |  China

I have added the AllItems list view as a listview webpart in a SharePoint page and also i have added a html button in the page content by placing a script editor webpart.

Now what i need is, When User A has logged in and viewing the page, the view should be like below, User A belongs to Hong Kong, so he should be able to see only items of Hong Kong

Title (Single line of text)   |  Country (Dropdown choice field)
----------------------------------------------------------------
Aaaaaa                        |  Hong Kong
Bbbbbb                        |  Hong Kong

This will be the view for User B, User B belongs to China and Singapore, so he should be able to see only items of China and Singapore

Title (Single line of text)   |  Country (Dropdown choice field)
----------------------------------------------------------------
Cccccc                        |  Singapore
Dddddd                        |  Singapore
Eeeeee                        |  Singapore
Ffffff                        |  China
Ggggggg                       |  China

Also, as i mentioned before, I have a html button in the page. By clicking that button the user should be able to export the current view in the page. Is there any option for that?

Things I have tried and I dont want to do:

  1. I dont want to create seperate view for User A and User B and add as webpart in page and set Target audience for those webparts. This approach is not dynamic
  2. I wont set item level pemission for each item so that by default user will not see other items he doesnt belong to.
  3. I wont go for customization too, everything should be through JavaScript

  4. For export to excel button, i dont want owssvr.dll approah as it will be static with a particular view. Eg. <site url>/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={<List GUID>}&View={<View GUID>}&CacheControl=1

Approach I need:

  1. I just wanted to know is there any way to achieve it through Client side rendering approach, so that the filter value set for the view should be dynamic

  2. I wish the export to excel should also be dynamic

  3. I got an idea like creating a complete list view webpart on page load using JavaScript. Is there any possibility for this?

Any help is much appreciated.

Thanks

  • Not sure about the view, maybe map these lists with look-up fields somehow? There's a good article on the custom export to excel button: danssharepointblog.blogspot.co.uk/2013/10/… – Gintas K Jun 22 '16 at 9:39
  • How do you say with lookup field am not getting you? Also I have already tried the export to excel as said in the blog you shared. But that is not wanted as i have already said in my question, it will not be dynamic. – Nagarajan Muthukumar Jun 22 '16 at 9:43
  • In Transactions list, your Country field can be a look-up to an item in User Configuration list and include User field as additional property. Then you can filter by that field in your view. And if the view will be dynamic, the export will be dynamic as well. – Gintas K Jun 22 '16 at 9:48
  • @GintasK don't think user fields can be added as additional properties in a lookup field. – Submits Jun 22 '16 at 10:02
  • 1
    @GintasK You can't use user fields in your calculated column formula either. Don't we just love SharePoint? :) Workflow could be an option, but more effort. – Submits Jun 22 '16 at 10:06

Your Answer

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

Browse other questions tagged or ask your own question.