Create master/detail record with related-items
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.
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.
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.
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.
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:
and this is what I get when trying to save:
Thanks for the help
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:
and this is what I get when trying to save:
Thanks for the help
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].
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].
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
- 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
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.
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.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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?
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?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Yes, please, drop the connection settings to support@spform.com.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests