1

We've created a custom SharePoint solution that uses the Related Item Column of the Task list. We're adding related items programmatically, and use the default display form for the task.

Our problem is that this field type seem to have a max 9 related items limit.

In our solution we need at least 20 items.

Can we change the limit for this field, or do we need to find another solution?

1

As far as I know there are no restrictions regarding the storage of related items in List. For example, the following example returns the actual number of related items stored in List:

var context = SP.ClientContext.get_current();
var web = context.get_web();
var listId = '73995d52-f210-480a-b16f-ac9bc63d52a0';
var itemId = 35;

var list = web.get_lists().getById(listId);
var listItem = list.getItemById(itemId);
context.load(listItem);

context.executeQueryAsync(
   function() {
       var relItemsVal = JSON.parse(listItem.get_item('RelatedItems'));
       console.log(relItemsVal.length);  
   },
   function(sender,args){
       console.log(args.get_message());
   }
);

From another side, SP.RelatedItemManager object is used when working with related items in SharePoint 2013. Specifically the SP.RelatedItemManager.getRelatedItems Method is used to retrieve all related items in task form as demonstrated in the example below:

var context = SP.ClientContext.get_current();
var relItems = SP.RelatedItemManager.getRelatedItems(context,listId,itemId);    
context.executeQueryAsync(
    function() {  
            console.log(relItems.length);
    },
    function(sender,args){
       console.log(args.get_message());
    }
);

And the point is, that no matter how many related items are actually stored in List, it returns no more than 9 items.

Solution

One of the solutions would be to customize Task Display Form page (handler for Show More link):

  • implement custom handler for displaying all the related items
  • and replace handler SP.UI.RelatedItems.ScriptApplicationManager.RelatedItemsControlReadOnly.ShowAll() (sp.ui.relateditems.js) that is used by default for retrieving and rendering all the related items in a List form
|improve this answer|||||

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.