Task Related Items on EditForm
- This topic has 3 replies, 2 voices, and was last updated 11 years ago by .
Viewing 3 reply threads
Viewing 3 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Classic DFFS › Task Related Items on EditForm
I can add the Task specific ‘Related Items’ field to the DisplayForm, but it doesn’t appear as an option to add the field to the EditForm? I know that this field doesn’t appear on the edit form in OOTB SharePoint, but I have been looking for a way to get the RelatedItems links to work off the EditForm (and the list, but that’s another story).
Hi,
It’s technically possible to have the related items functionality visible in EditForm, but if you change the related items, you are updating the current item – and will receive a save conflict when trying to save the form.
Therefore it is unfortunately not very practical to have it in other than the DispForm.
Alexander
Ahh, that makes much more sense!
I’m really only after the ability to go to the already linked related item (set up by a task), so I’ll dig around a bit to see if I can tease out the RelatedLinks section.
If you just want to show them in EditForm you can use something like this to read the values:
var res = spjs.utility.getItemByID({"listName":_spPageContextInfo.pageListId,"id":GetUrlKeyValue("ID"),"viewFields":["RelatedItems"]});
alert(res.RelatedItems);
This will output something like this (two related items):
[{"ItemId":31,"WebId":null,"ListId":null},{"ItemId":45,"WebId":"5b315066-48ba-42b1-9ef1-1387b67dcd9b","ListId":"5f82a17a-d27b-4f6d-8c2b-fa201e40b40b"}]
This must then be converted into a proper “link”, but if it is internally in one list you can use the “ItemId” directly to create the link using “/Site/List/DispForm.aspx?ID=XYZ”.
PS:If the link is internal in the list, the ListId and WebId parameter is null.
Alexander