none
Display by Default External Sharepoint List Association values RRS feed

  • Question

  • I have associated "External List A" with "External List B" on "Country" field.  For now when I edit item in External List B, I can pick the country values from the associated pick from external list A.

    Now, I want to display a default value of country or the first row from the associated external list A, when we go to the edit item of external list B.

    Thursday, August 7, 2014 4:15 PM

Answers

  • Hi,

    By design, the “Class External Content Type” textbox in the Student External List’s edit form will only display the corresponding value of the associated column which is connected as a foreign key in the two associated content type tables.

    In the other word, there is no out of box method to get the other column’s value and display them in  the “Class External Content Type” textbox. If you need to implement it in your environment, you need to use code.

    And, you can view the corresponding values of the associated column in the Student External List. However, the other columns’ value of the “Class External Content Type” table can’t be displayed in the Student External List. You also need to use code if you want to implement it in your environment.

    Best Regards,


    Linda Li
    TechNet Community Support

    • Marked as answer by JasonGuo Friday, August 15, 2014 2:29 AM
    Tuesday, August 12, 2014 4:25 AM
  • External content types are independent from the lists that are created. They are associated with the external content type. So when you are creating an associated column, you better make a Business Data column rather a lookup. 
    • Marked as answer by JasonGuo Friday, August 15, 2014 2:29 AM
    Tuesday, August 12, 2014 5:16 AM

All replies

  • Hi,

    According to your post, my understanding is that you wanted to display the associated values from External List A when you edited the items of External List B.

    I recommend that you can create an association between the two External Content Types following the steps as below to implement it in your environment.

    1. Open up your SharePoint designer 2013 and create two External Content Types which are connected by a foreign key. Also, please make sure you have selected “Create all Operations” for each external content type.

    2. Double click on the External B external content type and navigate to “Operations Design View”.  Right click on the External B external content type in the data source explorer and choose “New Association” to create an association between the two External Content Types.

    3. Open up your SharePoint site and create the External List A and External List B. Then, if you edit any items, you can see “Item Picker” in the edit form, click the “browse” button and see the values.

    The result is shown as below:

    And, if you want to set a default value such as “1” to the “Country” field in the External List B’s edit form, you can open the  External List B’s EditForm.aspx in SharePoint Designer 2013 and then add the following code under the <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">  tab.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> 
    
    <script type="text/javascript"> 
    
    $(document).ready(function(){
    
    $("div[Title='External Item Picker']").text("1");
    
    }); 
    
    </script>  
    

    There is an article for your reference, although it is about the SharePoint 2010, it still works for SharePoint 2013.

    http://lightningtools.com/bcs/lookup-foreign-key-values-in-external-lists/

    Best Regards,

    Linda Li


    Linda Li
    TechNet Community Support

    • Marked as answer by JasonGuo Friday, August 15, 2014 2:29 AM
    • Unmarked as answer by JasonGuo Friday, August 15, 2014 2:29 AM
    Friday, August 8, 2014 10:42 AM
  • Thanks for such a detailed answer.  Almost there . Two questions.

    Taking your example.

    1. I need to display the value of classname which comes in the first row and not hardcode it.

    2. Also, if there are more than one association, how do I modify the code given by you to specify only a specific external list association.

    Friday, August 8, 2014 1:04 PM
  • Hi,

    By design, it will only display the associated column’s value in the first row which is connected as a foreign key in the two associated content type tables. There is no out of box method to get the other column’s value and display them in the first row.

    And, the setted default value in the first row is the value which has existed in the associated column. You also can set other specific value into it.

    Best Regards,


    Linda Li
    TechNet Community Support

    Monday, August 11, 2014 6:24 AM
  • Yes, I understand the first row display concept. Can this be displayed in the value box of the external list ?

    In your solution , you are hard coding  "text=1", but I want to display the value of first row of text without hardcoding the value.

    Monday, August 11, 2014 12:09 PM
  • Hi,

    By design, the “Class External Content Type” textbox in the Student External List’s edit form will only display the corresponding value of the associated column which is connected as a foreign key in the two associated content type tables.

    In the other word, there is no out of box method to get the other column’s value and display them in  the “Class External Content Type” textbox. If you need to implement it in your environment, you need to use code.

    And, you can view the corresponding values of the associated column in the Student External List. However, the other columns’ value of the “Class External Content Type” table can’t be displayed in the Student External List. You also need to use code if you want to implement it in your environment.

    Best Regards,


    Linda Li
    TechNet Community Support

    • Marked as answer by JasonGuo Friday, August 15, 2014 2:29 AM
    Tuesday, August 12, 2014 4:25 AM
  • External content types are independent from the lists that are created. They are associated with the external content type. So when you are creating an associated column, you better make a Business Data column rather a lookup. 
    • Marked as answer by JasonGuo Friday, August 15, 2014 2:29 AM
    Tuesday, August 12, 2014 5:16 AM