I have been very confused about this topic for months:
First of all, I would like to describe how buttons are working under my understanding, in the case of validation and redirection:
Both buttons have redirection parameter. You can build the URL dynamically, using a list field value and run-time functions. You can't use calculated fields or control values, this is a very important point.
In the case of validation, both buttons can validate data, including list required fields and validation rules in the form.
Save and continue button hasn't redirection parameter. After saving data, the action is refresh page and you are in the same form again.
In the case of validation, only list required fields are validated, NOT the rules in the form.
You can redirect as Save and Submit button, Data will be not saved and of course, there is not any validation.
Keeping in mind that only Save & Submit button allow us the whole validation, and the limitations with redirection building (as far as I know), here is the solution:
To relationship parent and child, you need to pass the parent ID when you redirect to child form. I assume the parent element is previously saved (this is mandatory for my strategy), so parent ID exists in the ID field. The ID argument is included at the end of the URL string, something like that:
NewForm.aspx?: To call a new child form
ParentID: the parameter name to pass in the query string
ID: The element property, in this case, the ID field
I use a button (Save and Submit) called "Nuevo Hijo" to do it in my Parent form, using the dynamic URL in the redirection (sorry in Spanish):
(As shown in the picture, the child list is included in the parent form)
I would like to remark that:
In this case, you can not use a button. Instead of it, you select "Edit" from the menu of the selected element in the included Sharepoint list:
You can't pass the Parent ID using this method, but don't worry because you will have recorded it into child element previously.
The first thing to do into the new child form is to get the Parent ID from the URL string, using a calculated field:
When you finish the edition of the new child, perhaps you want to come back to the Parent form. To do it, we use a save and submit button, including a dynamic redirection URL string as:
fn-if(Is New Mode,Site URL/Lists/MyParent/EditForm.aspx?ID=fn-GetQueryString(ParentId),Site URL/Lists/MyParent/EditForm.aspx?ID=Parent_Id)
First of all, there is a conditional function that defines if the form is in a new mode or not, checking the value of Is New Mode Function.
As you are using Save & Submit button, first of all, data validation happens, then saving and finally redirect to the parent form
If you want to open a new child form, you only need to change the destination URL in the previous formulae:
fn-if(Is New Mode,Site URL/Lists/MyChild/NewForm.aspx?ID=fn-GetQueryString(ParentId),Site URL/Lists/MyChild/NewForm.aspx?ID=Parent_Id)
You can repeat this action as much as you want in order to create multiple child elements and finally come back to the parent form.
That's all. Any comments are welcome, of course, this is only an approach, for sure will be better solutions.
Have a nice workflow day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.