Get Related Item Values
Hello,
I have a related item that displays a record row of data values that I would like to capture using Jquery.
I have a related item that has 3 columns (Assigned, Processed and Cost). This Related item view has one record returned.
I want to get the value of each column record returned.
Can this be done?
I know how to count number values for each row to get a total but I don't know how to get the text value of a particular column.
Any help you can assist me with is appreciated.
Thank you,
Joe
I have a related item that displays a record row of data values that I would like to capture using Jquery.
I have a related item that has 3 columns (Assigned, Processed and Cost). This Related item view has one record returned.
I want to get the value of each column record returned.
Can this be done?
I know how to count number values for each row to get a total but I don't know how to get the text value of a particular column.
Any help you can assist me with is appreciated.
Thank you,
Joe
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Joe!
It's fairly straightforward.
fd.relatedItems(0).data('ctx').ListData.Row; - this command returns all rows from the first Related Items control on your Form as JS array with all rows stored as objects. Count goes from zero, like in regular JS.
fd.relatedItems(0).data('ctx').ListData.Row[0]; - this command will return first row from the first Related Items control as an object.
fd.relatedItems(0).data('ctx').ListData.Row[0].Title; - this command let's you access the specific value you are looking for, in my case I am getting the value of the Title column for the first row of the first Related Items control. Change Title to the name of your field and you are good!
You can also use browser's console on the Form to experiment a little and find what you should use in your code:
It's fairly straightforward.
fd.relatedItems(0).data('ctx').ListData.Row; - this command returns all rows from the first Related Items control on your Form as JS array with all rows stored as objects. Count goes from zero, like in regular JS.
fd.relatedItems(0).data('ctx').ListData.Row[0]; - this command will return first row from the first Related Items control as an object.
fd.relatedItems(0).data('ctx').ListData.Row[0].Title; - this command let's you access the specific value you are looking for, in my case I am getting the value of the Title column for the first row of the first Related Items control. Change Title to the name of your field and you are good!
You can also use browser's console on the Form to experiment a little and find what you should use in your code:
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Joe!
For getting and setting Field values check out this article on our site, it has a lot of information, including methods for Client and Server People Picker - https://spform.com/javascript-framework ... eld-values
If you'll still need the help with implementation, please let me know.
For getting and setting Field values check out this article on our site, it has a lot of information, including methods for Client and Server People Picker - https://spform.com/javascript-framework ... eld-values
If you'll still need the help with implementation, please let me know.
Cheers
Thank you Nikita for your assistance.
I get several elements when I execute this (fd.relatedItems(0).data('ctx').ListData.Row[0].EES_AssignedTo;) See below.
I need one addition piece of information that is provided when I execute the this:
[{…}]
0
:
{id: "201", title: "Shy, Renee", email: "rshy@ingenesis.com", sip: "rshy@ingenesis.com", picture: "https://ingenesisinc-my.sharepoint.com: ... MThumb.jpg", …}
length
:
1
__proto__
:
Array(0)
I need the "name" provided in the "title:" section in this case(Shy, Renee).
Is there something else I need to add to the above script to get the name?
Thank you for your assistance.
Joe
I get several elements when I execute this (fd.relatedItems(0).data('ctx').ListData.Row[0].EES_AssignedTo;) See below.
I need one addition piece of information that is provided when I execute the this:
[{…}]
0
:
{id: "201", title: "Shy, Renee", email: "rshy@ingenesis.com", sip: "rshy@ingenesis.com", picture: "https://ingenesisinc-my.sharepoint.com: ... MThumb.jpg", …}
length
:
1
__proto__
:
Array(0)
I need the "name" provided in the "title:" section in this case(Shy, Renee).
Is there something else I need to add to the above script to get the name?
Thank you for your assistance.
Joe
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Joe!
It returns an array where the first element is the object that you need, plus you need to access title property.
So all you need to do is use this command:
It returns an array where the first element is the object that you need, plus you need to access title property.
So all you need to do is use this command:
Code: Select all
fd.relatedItems(0).data('ctx').ListData.Row[0].EES_AssignedTo[0].title
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests