Create master/detail record with related-items

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Dars
Posts: 12
Joined: Thu Apr 07, 2016

12 Apr 2016

Hello,

I'm trying to see how the related-items works and even though I've read quite a few blog entry, I can't seems to figure it out :(
I'm trying to accomplish a master/detail scenario. As an example: Purchase Order / Purchase Order Items
So I have two lists. The Purchase Order Items list have a PO_id lookup field which refers to Purchase Order -> ID field.
So on my form for Purchase Order, I have a few fields and also the related-items control. From the following blog-entry http://formsdesigner.blogspot.ca/2015/0 ... e-for.html I created the javascript snippet
fd.populateFieldsInGrid($('.related-items'), {
TransfertQuartID: GetUrlKeyValue('ID'),
});
and also identified "related-items" to the CSS class of the related-items control.
It's not working and I also don't understand why it would because the GetUrlKeyValue('ID') should not return anything until my parent record is saved, isn't??
Thank you.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

13 Apr 2016

Hello,

You're right, GetUrlKeyValue('ID') doesn't return anything if you're on the new item form as the item hasn't yet been created and its ID assigned, so please refer to this blog post http://formsdesigner.blogspot.com/2015/ ... -form.html. You seem to be doing everything correctly, only you need to use the {CurrentItem} token and make sure you're using the correct internal name of the field.

Dars
Posts: 12
Joined: Thu Apr 07, 2016

13 Apr 2016

Hmmm, Ii still can't get it to work :(

I'm sure it's a 15 inches problem (15 inches in front of the screen) but can't figure it out even though it seems quite simple. Here is my setup, we can see my class assigned and also the javascript portion:

Image

and this is what I get when trying to save:

Image

Thanks for the help

Dars
Posts: 12
Joined: Thu Apr 07, 2016

13 Apr 2016

Ok, can't figure how to add image too :(

So here's my javascript snippet:

fd.populateFieldsInGrid($('.related-items'), {

TransfertQuartID: '{CurrentItem}',

});

I have "related-items" CSS class defined under Layout.

My related-items control Quick Edit property is set to "Only"

Whenever I save the record, I get the following message: "The list item could not be inserted or updated because invalid lookup values were found for the following fiel(s) in the list: [TransfertQuartID].

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

14 Apr 2016

Make sure:

- you're using the correct internal name of the lookup field name (check “from the browser” section on this page http://techtrainingnotes.blogspot.com/2 ... y-and.html )

- the lookup field points to the ID field of the correct list

Dars
Posts: 12
Joined: Thu Apr 07, 2016

14 Apr 2016

Everything seems to be setup properly. My lookup field on my "detail" list refers to the ID of the "header" list.

What I have just noticed is that if I create a new entry, specify only the information for the header and nothing for my "detail" list (therefore entering nothing in the related-items control) and then save the entry. Then I get my record created in my master list. If I edit this record and then enter data in my related-items control, the TransfertQuartID gets populated with the ID from the master list.

The only Javascript I have in my form is the following:

fd.populateFieldsInGrid($('.related-items'), {

TransfertQuartID: '{CurrentItem}',

});

Unless I'm mistaken, it should work in New and Edit mode as per your previous comments about using {CurrentItem} rather than [ID] since it doesn't exist yet at the creation of a new entry.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

14 Apr 2016

Hi,

What edition of SharePoint do you use: online or on-premises? What's your version of Forms Designer (you can find it in the lower right corner of the designer)? Is it possible to provide temporary access to the form?

Dars
Posts: 12
Joined: Thu Apr 07, 2016

14 Apr 2016

I use Forms Designer 3.0.6 and we are using Sharepoint 2013 Foundation on-premise.

I could arrange a Go-to meeting and share my screen if you want?

Thank you.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

14 Apr 2016

Yes, please, drop the connection settings to support@spform.com.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests