1

For one of the Requirements Implementation, I have to filter the Choice Drop-down values and from a condition perspective, i need to retrieve list items from a list called 'Company List'.

The library form where I need these list items to be retrieved is on one of the Subsites and the Company list resides at the Parent/root.

Here are the list column names present in the Company list: Project, Company, Role and EIN. Here is the URL to Company List: https://****.sharepoint.com/Lists/CompanyEntity List/AllItems.aspx
Now using this URL, I want to fetch only the Company Column values where value of the Project Column Equals "Project A". Is this something doable using JSOM? Also this retrieval should take place prior to metadata population on the library upload form.

Can someone help me out with the JSOM code to achieve this as I am working with SharePoint online.

2

SPServices have a helper for this. This will achieve your requirement. SPServices is a jQuery library which abstracts SharePoint’s Web Services and makes them easier to use. http://sympmarc.github.io/SPServices/value-added/SPCascadeDropdowns.html

The provided example can be modified for you specific columns and list. You will need to get the jquery and spservices javascript files and upload them to an appropriate location on your site collection (i.e Style Library or Site Assets). The html code will need to be added to the list edit form page, from either a content editor webpart or HTML form webpart.

<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.11.3.js"></script>
<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery.SPServices-2014.02.min.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "Regions",
    relationshipListParentColumn: "Country",
    relationshipListChildColumn: "Title",
    CAMLQuery: "<Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq>",   parentColumn: "Country",
    childColumn: "Region",
    debug: true
  });
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "States",
    relationshipListParentColumn: "Region_x0020_Name",
    relationshipListChildColumn: "Title",
    relationshipListSortColumn: "ID",
    parentColumn: "Region",
    childColumn: "State"
  });
});

</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.