Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

Sharepoint Lookup or Calculation

I have two WSS 3.0 lists: one called Issues and a second called Client Table.  In the Issues list, I have a column called Client which stores a company name like "Acme".  In the Client Table list, I have a column called Client and another with the associated Username.  Assuming a 1-to-1 relationship & without doing a lot of coding, is it possible to return the Username to a new column in the Issues list from the Client Table list based on the value of the Client column in the Issues list?  If so, how would I do this?
1 Solution
Well, I tried this with content types and using site columns. This does not look possible using OOB site column functionality.

You can either go with the following approaches:
- Make the new column (where you need to pull the user from the Client Table list) and the clients column in the Issue list as lookup columns to pull the user from the Client Table list.
Modify the NewForm.aspx page in the Issue list to have custom javascript to automatically select the username when the user selects the Client from the drp down.

This looks like the simplest way to get this done. But it does require customization.

Another way will be add an event handler to the list.
The event handler should be using ItemAdded method of the SPItemEventReciever class

and in this method, you can add your functionality to collect the data from the Client Table list and match it with the one the user has filled.

You mentioned that there is 1-2 relationship, but using OOB columns, SharePoint is not that intelligent to detect it. Thus, custom event handler needs to be created to have that 1-1 relationship addressed.
You should create a new column in the Issues list called "User" that is hidden. Create a workflow (On Create) for the Issues list that will Set the Field (User) to [Client::Title WHERE Client::Title == Issues::Client]

The above pseudo-code will make sense in the workflow designer within SharePoint Designer.

All you have to do now is make sure the "User" column is displayed in the list view you want to show people. This is also assuming a 1-1 relationship. You will have to add additional workflow on the Client list if you want to keep the Issues list up to date or if you want to account for 1-many relationships.

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now