SharePoint Online: Filter Assets based on the Requester of the Ticket

Introduction

In Crow Canyon Service Request product there is an Assets list. In this list IT assets can be maintained and in Tickets list there is a lookup to the Assets list. Assets list has ‘Employee’ field for the user to whom the asset is assigned. While creating the Ticket it is convenient to filter the Assets lookup column based on the requester of the Ticket as otherwise it will be difficult to select the right Asset in the Ticket if there are many assets in the system.

Pre-requisites

  • Tickets list should have lookup to the Assets list and the column name is “Related Asset”
  • Assets list has a single user Person and Group field with column name “Employee”
  • There should be an index on Employee column in Assets list. Without this index, loading will be slower in the Ticket form. To know more details about how to index a column in SharePoint please refer this article

Configuration Steps

Upload the script files

1. Download AssetsByRequesterEdit, AssetsByRequesterNew, and CurrentUserInfoFiller

2. Navigate to folder: Site Content -> Site Assets -> CrowCanyon -> CurrentUserInfoFiller -> Upload and replace ‘UserInfoFiller.js’ file

3. Go to Site Assets library from Site Contents list and create a folder CCS if it doesn’t exists and upload ‘AssetsByRequesterNew.js’ and ‘AssetsByRequesterEdit.js’ files

Enable filtering in Ticket New Form

4. Copy both file (‘AssetsByRequesterNew.js’ and ‘AssetsByRequesterEdit.js’) URLs for further use

5. Open Tickets list from Site Contents and open ‘Default New Form’ under ‘List’ ribbon (Open site in browser other than ‘Google Chrome’)

6. Add Content Editor Web part to ‘Default New form’

7. Edit Content Editor web part and add ‘FilterScript_RelatedAsset.js’ file URL (copied in step 4) under ‘Content Link’ and configure as shown

 

Stop Page editing

Enable filtering in Edit form

8. Open ‘Default Edit Form’ under ‘List’ ribbon (Same as in Step 5)

9. Add Content Editor Web part to ‘Default Edit form’ (Same as in Step 6)

10. Edit Content Editor web part and add ‘FilterScript_RelatedAsset_EditForm.js’ file URL (copied in step 4) under ‘Content Link’ and configure as shown in Step 7

Verify the functionality

11.Clear browser cache and refresh site.

12. Now in Tickets list New Form and Edit Form you can see ‘Filter’ button beside ‘Related Asset’ field

13. If we click on ‘Filter’ button ‘Assets’ under ‘Related Assets’ dropdown will get filter based on the Ticket Requester.

Leave a Reply