sharepoint list custom edit form show related lookup column field values

Cindy Mello 62 Reputation points
2021-07-14T16:43:08.1+00:00

I have a list, and use a lookup list to populate a drop. the Lookup list has 3 fields, plus id

In the parent list the columns pulled from lookup are
Company
Company:Address
Company:City

I can select the Company and save in New form and in the list I see the related values.

Be when I open the Edit list the fields (would be read only). only Company is there
Company:Address
Company:City

When I select the company either in New or Edit form I want to see the related values and then click save etc.

I am using a solution to created and display fields in a custom form.
https://www.markrackley.net/2013/08/29/easy-custom-layouts-for-default-sharepoint-forms/

So I think this will have to be a javascript? Example for the JSON?
I get from the parent list the company name and do api call to related list to get the value array?

I can see it but am very bad with scripting. any examples would be very helpful and appreciated.

Cindy

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
897 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,363 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,706 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Emily Du-MSFT 42,346 Reputation points Microsoft Vendor
    2021-07-15T08:54:31.713+00:00

    @Cindy Mello

    Here're steps:

    1.Create a parent list named "Company". Then create Company, Address and City columns in the list.
    114996-1.png
    2.Create a list named "lookup". Then create a lookup column named "Company" in the list.
    114997-2.png
    3.In the lookup list, click ribbon -> List tab -> From Web Parts -> Default New Form -> Add a Web Part -> Media and Content -> Script Editor -> Edit Snippet -> Add codes in the txt file115024-codes.txt.
    4.Result:
    115031-3.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. GB 1 Reputation point
    2022-06-28T18:49:42.003+00:00

    @Emily Du-MSFT
    This is really helpful, thank you. The part I can't find is

    the lookup list, click ribbon -> List tab -> From Web Parts -> Default New Form -> Add a Web Part -> Media and Content -> Script Editor -> Edit Snippet -> Add codes in the txt file115024-codes.txt.

    Where do you find the "list tab" and "From Web Parts" section? Is this from the list page itself? If so I don't seem to have that option.
    thank you.

    0 comments No comments