Page 1 of 1

Related Item Creation on Parent New Form Problem

Posted: 24 Oct 2018
by gaj
Hi,
if I´m using your Code desc. here https://spform.com/documentation/relate ... gular-mode this works only for me if the parent List already has at least one Listitem.
If not (creating the first record in the parent list) the parent-id will not be set in the related Item New-Form (Dialog).
I´m using FD 3.1.5 with SPO

Thx for helping me.

Re: Related Item Creation on Parent New Form Problem

Posted: 25 Oct 2018
by AlexZver
Hi!

So, I've checked it out, the Related Items functionality from the instruction below works fine, most probably you have some errors in the implementation.
Here is the list of the frequent errors can be encountered:
1) Check whether you replace ‘Parent’ with the internal name of the lookup field in the source in the JavaScript code snippets, here:

Code: Select all

fd.populateFieldsInGrid($('.related-items'), {
  Parent: '{CurrentItem}',
});
and here:

Code: Select all

if (window != window.top && window.top.fd) {
  // the form is opened in a dialog from the parent form
  var parentId = parseInt(window.top.GetUrlKeyValue('ID'));
  if (parentId) {
    // the form is opened from the Edit form
    fd.field('Parent').value(parentId);
  } else {
    // the form is opened from the New form
    $('#_fd_parent_temp > input').val(window.top.fd._tempParentId());
  }
   
  $('.parent-field').hide();
}
2) Check whether you switch CDATA property of the HTML-control to False.

Please try to make a brand new Related items implementation considering these subtle moments.

Re: Related Item Creation on Parent New Form Problem

Posted: 30 Oct 2018
by gaj
Hi,

the problem only accur if the Lookupfield is a CrossSiteLookup and not a sttandard Lookup - Field!

How to set back a CrossSiteLookup to a standard Lookupfield.

thx for help

Re: Related Item Creation on Parent New Form Problem

Posted: 30 Oct 2018
by AlexZver
Hi,

Don't you forget to reload DataSource for Related Items control after changing a Lookup to a CS Lookup? It works fine with CSL on my tenant.

If you want to revert from CS Lookup to Lookup, you just need to remove JSLink property.

Screenshot_79.png
Screenshot_79.png (11.59 KiB) Viewed 2146 times