Forum Discussion
Best way to record multiple client details for one record in SharePoint list
EmmaVR so in the example below there is a second list for the contacts. I have renamed the Title column to Company but when you create the lookup column it will still refer to Title which is the internal name of the column. The columns are all single line of text columns.
Then in your main list create a lookup column and select the source as your contacts list. Select the column you want to display when you do do the lookup.
Select the columns from the lookup contact names list that you want to be included in your main list. You don't have to include all of them, just the ones that will be useful in your main list. Make sure you select allow multiple selections so that you can have multiple contacts for every item.
The column I selected above to display was Name. When you edit an item or create a new item in your main list the Contacts column will display all the names and because you selected multiple items you can select multiple names.
Selecting the contacts will then put the other details into the relevant columns.
So as well as your project columns you will end up with Contacts column plus the columns you selected earlier.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)
May I take it a possible step further and check to see if JSON could then format these columns to put each contacts details on a new line, within the same line item? Would something like this be possible?
- Rob_ElliottOct 27, 2023Silver Contributor
EmmaVR yes this can be done adding the following JSON formatting to each of the additional columns in advanced mode.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "div", "style": { "white-space": "wrap", "width": "100%" }, "txtContent": "=replaceAll(@currentField,';','\n')" } ] }which gives the following result:
For the main Contacts lookup column you can use the following JSON:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "div", "style": { "white-space": "wrap", "width": "100%" }, "txtContent": "=replaceAll(@currentField.lookupValue,';','\n')" } ] }Hope that helps.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)- EmmaVRNov 01, 2023Copper Contributor
Thank you for taking the time out of your day to assist me with this query! Much appreciated.