Skip navigation
All Places > Getting Started > Blog > Authors f.falomir@ube.es

Getting Started

3 Posts authored by: f.falomir@ube.es

Dear all:

I have been very confused about this topic for months:

  • How to navigate from a parent form to child form and come back?
  • How to navigate from a child form to a new one child form keeping the parent link?
  • How to validate child form data before come back in both cases?

I think I have now a good approach to do it without javascript. 

 

How buttons work

First of all, I would like to describe how buttons are working under my understanding, in the case of validation and redirection:

Save and submit button / Save button:

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:

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.

 

Cancel Button

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:

 

Parent ID to new child form

 

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:

http://Mysite/Lists/MyChild/NewForm.aspx?ParentId=ID

 

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:

  • Data in the parent form will be saved and validated before navigation
  • The parent ID will be used to come back and to record it into child list element to make the relationship between parent and child.

 

Parent ID to an existing child form

 

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.

 

Working into child form

 

Storing the Parent ID

The first thing to do into the new child form is to get the Parent ID from the URL string, using a calculated field:

 

 

  • Formula: you get the parent id value from the URL string using the fn-getquerystring function
  • Connected field: the field name into the child list to store the Parent ID
  • Formula calculation ONLY in the new mode. Because if you are editing the child you have the Parent ID  recorded yet and you will not send from Parent form again.

 

Save and Submit Button and return to the parent form

 

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.

  • In case of a new mode,  you define the URL taking the Parent ID who is the URL passed from the Parent form fn-GetQueryString(ParentId)
  • In case of not a new mode, you define the URL taking the Parent ID from the Parent_Id field value (that you have stored using the calculated field when you was in new mode)

As you are using Save & Submit button, first of all, data validation happens, then saving and finally redirect to the parent form

 

Save and Submit Button and open a new child form (keeping the parent ID in the URL string)

 

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! 

Dear all:

It's a simple workaround to assign a temporary "unique" value to an element before create it in the list.

 

When you are creating an new element using Nintex Forms, you don't have the "ID" value until you "save" the element the first time.

 

Imagine you want to link some child list elements before save the parent element the first time. You need the parent element "primary key" to link with the child, commonly the "ID"

(Check Forms: Parent / Child structure using List view Control to know how to link a parent element with a child elements in a separate list)

 

I don't know how to generate a "unique value" into Nintex Forms in a easy way , so the workaround could be to generate a temporary "ID" as a "fake unique value"   to assign to the new child items.

 

Then, when you save the parent element and run the workflow, it could re-assign the "ID" just created to the child elements,  getting the child list items in a collection variable, looking for the elements with the "fake unique value", and changing the linking field to the correct "ID"

 

Here is the conceptual workflow:

 

Now, here is the approach to generate a "fake unique value" into the nintex forms. It's a fake, but it works!

 

Th idea is to use the current date / time and the current user  into a disconnected calculated field. As for sure you are "unique" in the active directory, and you can't be in two places at the same time (if you are a God, it could be), the value is "unique"!! 

 

 

Here is the formula (sorry, in Spanish):

 

  • Fecha Actual: Current date
  • Hora Actual: Current time
  • Usuario actual: Current user

 

Now, you must send this "fake unique value" to the child element adding the value at the end of the URL string. In the new child element form, you can get this value, as shown in Forms: Parent / Child structure using List view Control 

 

Then, when you finally save the parent element, and the workflow begins to run, you can change this fake value by the appropriate "ID". In my case, I'm using not the ID but a sequential fiscal year / number generated by the workflow, but the approach is the same (because I can't generate this number in the Forms).

 

That's all. 

Have a nice day!!

 

parent child forms listviewcontrol beginner

 

Me

First of all, excuse my english, please.

I'm not an expert, but I would like to share with you my first significant development using Nintex Forms. It could be easy, but I'm very happy with it  

 

I have just developed a Parent / Child structure using List view control to show child list inside Parent Form. The idea is to have child data in a independent list in order to manage the elements properly.

I'm not satisfied with the repeating section to do it, because data is not easy to manage later, for example if you want to do tasks for each child element using workflow, or to make a report downloading the lists to Excel file and working with Power Pivot.

 

My targets are:

- To have the child data only in one place (not in XML in the parent list and the duplicate in a child list)

- To have the parent "primary key" in the child list to have the relationship in the reporting system (in my case Excel and Power Pivot functionality)

- To allow the update of the created child items when you want

- To use workflow to create / manage tasks using the child elements

 

The example:

In this case the parent child has data about process events in a Chemical Industry, and the child list has actions to do by the staff related with each event in the parent list.

 

The process:

Let me show my parent form. I use "tabs" to distribute and organize data using the wise advices learned in the forum 

 

The red mark shows the "primary key" of the parent element, generated using workflow when the element is created.

 

The tab "Acciones" has the list view control with the child items. You can see the primary key in the first column:

The list view control is filtered using a calculated control in the form, who stores the "primary key"

So, only the actions related with the parent item appears 

 

 

(Be careful here, you can filter and sort the list using the list headers. If you do it, filter values could be removed. I'll show you how to avoid it later on)

 

New child item

To create a mew child item, I have prepared a button on the top of the list.

 

 

 

The button is "save and send" type, and I use URL redirection property to point to the child form with the parent ID at the end of the URL string:

 

http://xxxxxxxxxxxxxxxxxxx/Lists/I_OP_Acciones/NewForm.aspx?ParentID=ID 

 

I'm not using the list "Add new item" link (by default it appears in the Sharepoint list) because I don't know how to pass the ID variable to it. In fact, I just remove the link to avoid troubles. I'll explain how to do it later on.

 

In the child form, I get the ID to update the key item. Let me show how:

 

I use a calculated control to geet the ID value from the URL string, using the following formula:

 

buscar("Incidentes_Operacion","ID",fn-GetQueryString(ParentId),"Num_Incidente")

 

Buscar (in spanish here) is Lookup the parent  list "Incidentes_Operacion" to get the parent primary key "Num_Incidente"

 

fn-GetQueryString is the function to get the variable from the URL string (Thank you very much Marian Hatala )

 

Now, you connect the calculated control with the appropiate child column and the relationship is done 

 

Updating an existing child item

In case of you want to update an exisiting child item, yo don't need to pass the key, because the child item get it when it was created. So, you can use the update action from the child list menu in the list view control in the parent form:

 

 

Back to the parent form from the child form when you finish edition:

By default, when you save the child form, Sharepoint come back to the list. So you need some code to return to the parent form (and to the related parent item). I use the following strategy:

 

The button "GUARDAR" is save and continue button. The user click on it to save data. The button Volver is not a button, is a calculated field with an hyperlink (there are  examples in the community of how to do it):

The formula that I'm using to back to the parent form is:

 

"<a href=\" http://xxxxxxxxxxxxxxxxxx/Lists/Incidentes_Operacion/EditForm.aspx?ID="+CC_Parent_ID+" \">Volver</a>"

 

CC_Parent_ID  is the calculated field I use to get the parent ID from the parent list using lookup formula and using the child column with the "primary key" as an argument. So, using this link you navigate back to the parent form.

 

This method has to advantages:

- You came back to the parent form from both new item action or updating action 

- The parent form is UPDATED with the new data when opens 

 

Finishing

 

Removing "add new item" funtonality in the chil list view and header filter / sort functionality:

 

As commented, you need to remove "add new item" and "header filter / sort" functionality from the child list into the parent form to avoid mistakes.

 

To do it, you must to edit the page when the parent form is alocated and include a web part selecting "Command sequence Editor" (I think is something like that, in spanish is "Editor de Secuencias de Comandos":

 

Then you must include the following code fragment:

 

The first fragment is to remove the add new link

The second one to remove header funtionality, in this case in the primary key column

 

Save the changes and the work is finished. 

 

Thank you for your attention. Any comment will be wellcome.

 

BR

Filter Blog

By date: By tag: