Loop through related items and set/populate field
Hi guys.
I have a new form that includes one related items list (master/detail).
I am looping through the related list to get data and all is working well.
Now I received a request that when I loop through the related items list I need to edit each line and populate a 'single line text' field in the related items.
Can I populate a field in related items (it is in regular mode) when looping through the related items list?
Regards
I have a new form that includes one related items list (master/detail).
I am looping through the related list to get data and all is working well.
Now I received a request that when I loop through the related items list I need to edit each line and populate a 'single line text' field in the related items.
Can I populate a field in related items (it is in regular mode) when looping through the related items list?
Regards
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Oz,
This really is not a trivial task... The only thing I can think possible is to loop through the items, then send a request to the list in question, find the correct item and update it. Read more about it here - https://msdn.microsoft.com/en-us/librar ... e.14).aspx
This really is not a trivial task... The only thing I can think possible is to loop through the items, then send a request to the list in question, find the correct item and update it. Read more about it here - https://msdn.microsoft.com/en-us/librar ... e.14).aspx
Cheers
Thank for the reply Nikita - I want to try to explain better.
Attached is a screenshot of the master new form.
- When a user adds a detail ('related items1'), the fields (with red box) "Material Short Text" and "Material Long Text" are empty.
- Unfortunately it is vital for the user to see these two field in the master new form - before they save the master.
- But today these two fields are populated with a workflow. The string for both field is created from several "additional lookup fields" that are in the detail list - so I need to stop using the workflow and do this in the form.
The problem with creating the strings in the 'detail new form':
- When I create a 'detail' and select from the lookup fields, the "additional lookup fields" do not populate until the 'detail new form' is saved. So I can not use javascript to create the string in the 'detail new form'. Unless there is a way to refresh the 'detail new form' so the 'additional lookup fields' populate?
- I can not save the 'detail new form' and redirect to 'detail edit form' to create the string, because then I loose my master detail connection.
So I need to find a way to create the strings in the 'master new form':
- I added an additional 'related items2' to the form - but I hide it with js. It is a duplicate of 'related items1' but the view only displays the 'additional lookup fields' that I need to build the strings.
- When I add a new detail and return to the 'master new form', this hidden 'related-items2' refreshes and shows all the values I need to create both strings.
- I use js to loop through the hidden 'related-items2' and get the values I need to create my two strings.
So the final step is where I am stuck:
How can I loop through the previous 'related items1' and insert the string into "Material short text" and "Material long text"?
I have the string ready, I just need a way to populate these two fields in each detail in 'related items1'.
Final outcome
- The user can see "Material short text" and "Material long text" for each detail in the 'master new form'.
- The user can save the 'master new form'
Attached is a screenshot of the master new form.
- When a user adds a detail ('related items1'), the fields (with red box) "Material Short Text" and "Material Long Text" are empty.
- Unfortunately it is vital for the user to see these two field in the master new form - before they save the master.
- But today these two fields are populated with a workflow. The string for both field is created from several "additional lookup fields" that are in the detail list - so I need to stop using the workflow and do this in the form.
The problem with creating the strings in the 'detail new form':
- When I create a 'detail' and select from the lookup fields, the "additional lookup fields" do not populate until the 'detail new form' is saved. So I can not use javascript to create the string in the 'detail new form'. Unless there is a way to refresh the 'detail new form' so the 'additional lookup fields' populate?
- I can not save the 'detail new form' and redirect to 'detail edit form' to create the string, because then I loose my master detail connection.
So I need to find a way to create the strings in the 'master new form':
- I added an additional 'related items2' to the form - but I hide it with js. It is a duplicate of 'related items1' but the view only displays the 'additional lookup fields' that I need to build the strings.
- When I add a new detail and return to the 'master new form', this hidden 'related-items2' refreshes and shows all the values I need to create both strings.
- I use js to loop through the hidden 'related-items2' and get the values I need to create my two strings.
So the final step is where I am stuck:
How can I loop through the previous 'related items1' and insert the string into "Material short text" and "Material long text"?
I have the string ready, I just need a way to populate these two fields in each detail in 'related items1'.
Final outcome
- The user can see "Material short text" and "Material long text" for each detail in the 'master new form'.
- The user can save the 'master new form'
I hope my last explanation clarified what I am trying to do.
I haven't found anything about this in the forum nor in your documentation - but maybe I missed something?
Hopefully you know how to insert a string into the details items (as mentioned I need this to happen in the +master new form' after I created the detail(s)).
Kindest regards.
I haven't found anything about this in the forum nor in your documentation - but maybe I missed something?
Hopefully you know how to insert a string into the details items (as mentioned I need this to happen in the +master new form' after I created the detail(s)).
Kindest regards.
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Oz,
I can see that this is important for you, unfortunately, this is quite a complex case and solving will take a lot of our development time. If you are interested in purchasing extra support minutes for us to implement the request, let us know all the requirements in an email to support@spform.com
We will evaluate your request and tell you how much time it will take, then you can decide if you want to purchase the development of this or not. As it is, there is no easy option to do so with the Related Items control alone, you'll need to use JavaScript to make it work.
I can see that this is important for you, unfortunately, this is quite a complex case and solving will take a lot of our development time. If you are interested in purchasing extra support minutes for us to implement the request, let us know all the requirements in an email to support@spform.com
We will evaluate your request and tell you how much time it will take, then you can decide if you want to purchase the development of this or not. As it is, there is no easy option to do so with the Related Items control alone, you'll need to use JavaScript to make it work.
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 8 guests