cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Default Value in repeating section (first row - why!!)

I have a very simple repeating section with some text values. I'm basically collecting some values on the initial form and saving them into list item fields. 

Then a task form gets created with that repeating section, all I want is that the fields in the repeating section gets auto-populated with default values from the data I'm collecting on the initial form. 

The funny thing, it is working fine when I add new line items in the repeating section, all default values that I want are in there. But just not the first line in the repeating section. 

I added the default value of each field to be populating from the list item field. I also changed the null display value to be populating from that list item field. Still can't get the first line to auto-populate the default value. 

Using SP/Nintex 2016 on prem.

Thoughts?!

0 Kudos
Reply
15 Replies
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

I think that I might understand what you're trying to say... kinda. 

Are you saying that you want to take the Repeating Section data from the form on List A, and then reuse that exact data in a Task Form? 

If that's the case then you simply need to pull the XML data from the Repeating Section on the Form on List A into a Workflow Variable, and then link the Repeating Section of your Task Form to the Workflow Variable in question. 

--------------

But because you're talking about adding new data and control defaults, I'm not sure if that is the scenario you're trying to describe. 

One 'gotcha' with Repeating Sections is that  any Item (List Item that is) that is being generated by an outside force (for instance, via a workflow), doesn't know what the default values are that you have set to the Nintex Form controls and just generates a 'correct' XML structure (for the repeating section) that doesn't have any values populated. 

Because of this, when you enter the form, the FIRST row will default to the BLANK values generated during the Item's Pre-Creation, and subsequent rows that have been added will default to the correct values based on the configuration of the Nintex Form Control. 

One way around this (for Task based Forms) would be to create a Multi-Line Text Workflow Variable, set the initial value to the Repeating Section XML with your desired default values included, and then link the target Task Form's Repeating Section to said Workflow Variable. 

Once you have completed the Task, that Workflow Variable will contain all of the values entered into the Repeating Section for said task and you parse to your heart's desire. 

For more information on parsing XML for repeating Sections see: 

Nintex Forms/Workflow - Parsing Repeating Section Data - Vadim Tabakman 

How to parse a repeating section xml with for each action? 

Populating Repeating Section Controls with List Data 

 

If this doesn't help, could you please describe in a bit more detail what it is you're looking to accomplish? 

Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

Hi nmarples

re: Are you saying that you want to take the Repeating Section data from the form on List A, and then reuse that exact data in a Task Form? 

Nope, I only have one repeating section on the task form that I want it to auto populate the first line with some simple calculated fields that I get from the list A - not a repeating section.

So to explain more.. here is some screenshots: 

My main form is this:

It has a lookup where I auto populate some numbers and I save those numbers (connected them) into a list item field. 

I save the department code 806 and division # 5 into two txt fields, divCode and deptCode... 

Then I create my task form which has the repeating section. That repeating section contains two unconnected text fields, however my whole repeating section is normally connected to a MLT field. 

I have defaulted the value to be my simple txt field that I collected from the main form.

now my default values are showing completely fine on new lines. but not on the main first line that shows by default. I don't want the users to have to delete the first line and add a new line then those values will show!

Does that explain it a bit!

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

Ah. Yeah, then the secondmost part of my post is what you're looking to do. Because the Item (A Task is technically just an Item that is on a 'Task List'... which we can just treat like a regular list) is being generated by a workflow, the Repeating Section information is essentially being generated as if it were blank. 

Default values only default TO their value if you are generating them IN REAL TIME, that is, if you're actually looking at them during the time of their creation. This happens when you create a New Item, but NOT when you are Editing an Item!!! In the case of a Repeating Section, adding a new row will CREATE a new set of fields which will abide by their defaults!

How to get around this? 

You'll need to create some generic Repeating Section XML, like...: 

<RepeaterData>
  <Version />
  <Items>
    <Item>
      <RS_Account type="System.String"></RS_Account>
      <RS_Division type="System.String"></RS_Division>
      <RS_Department type="System.String"></RS_Department>
      <RS_Activity type="System.String"></RS_Activity>
      <RS_Amount type="System.Double"></RS_Amount>
    </Item>   
  </Items>
</RepeaterData>

Note: This assumes that your controls have been NAMED as shown above (RS_Account, RS_Division, RS_Department, RS_Activity, RS_Amount). If you haven't named your controls, do so. If you use different name then you'll need to use whichever names you have setup as replacements for all of the examples I'm using!!!!


and set it to a Workflow Variable: 

Then you can use the Update XML Workflow Action to setup this generic XML to the way that you'd like it to display upon editing:

(You'll notice that I have (2) Updates taking place, which can be accomplished by clicking on the Add XML Update link on in the configuration dialog:

If you need to Query a list elsewhere to get the values of those two fields (Department and Division) then you can do that and set those to two Workflow Variables respectively. If not then you can just replace the example Workflow Variables I'm using (currentDivisionValue / currentDepartmentValue) with the List Item column data. 

Now that you have usable xml, you can target that in the task form. Open the Task Form containing your Repeating Section and set the 'Connected To' value to the Workflow Variable containing your XML: 


Now the moment of truth! We should be able to see our values on the first row, and the "default" values on the next rows. 

Initial Loading of Task Form: 


Adding of Row: 


this should put you in the right direction. 


Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

Thanks ‌, I'll give it a shout sometime today and let you know. It sounds about right to me. 

I'm also having another issue...  I'm taking the mlt values and html-izing them to put them into my email They were all workgin fine until i started putting those default values... All fields that done't have default values such as the account and amount are showing fine in the html. I can send you some screenshots of that if that would help. 

Thanks again for jumping in to help with this.. much appreciated.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

mlt values? 

The more screenshots the better!

I would also post any related material about how you are generating the html for your emails in question, and even any generated html that doesn't seem to be working. 


0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

Hi again nmarples‌,

MLT == Multiple Line of Text field

So, what we are doing is we are querying the xml and getting the repeating section data before and after every task to show on the email being sent on the coming flexi-task. Also we are doing it again after the task so the next stage will have the most recent repeating section data, that's because the users can change the repeating sectio on the task before it moves on. 

Here is how the configuration is looking like:

Where {itemproperty:Coding} is the Mutliple line of text field that is connected to the repeating section. 

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- transform repeating section from xml to html -->

<xsl:template match="/">

<xsl:apply-templates />

</xsl:template>

<xsl:template match="Items">

<table border="1" width="100%" style="border-collapse:collapse;background-color:#eee;border:1px solid;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">

<thead>

<tr>

<td>Account</td>

<td>Division</td>

<td>Department</td>

<td>Activity</td>

<td>Amount</td>

</tr>

</thead>

<tbody>

<xsl:apply-templates />

</tbody>

</table>

</xsl:template>

<xsl:template match="Item">

<tr>

<!-- field output order -->

<xsl:apply-templates select="Account" />

<xsl:apply-templates select="Division" />

<xsl:apply-templates select="Department" />

<xsl:apply-templates select="Activity" />

<xsl:apply-templates select="Amount" />

</tr>

</xsl:template>

<xsl:template match="Account">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Division">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Department">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Activity">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Amount">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>


</xsl:stylesheet>

now, al the values that were manually keyed in are coming throught from one task to the other with no issues. But eh items that were defaulted are not coming through.... and I can't figure why? 

they were defaulted fine: 

Added the rest of the info and submitted the task. 

The following task came back as this!! Only the manually keyed in values are the ones that came through... why?

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

‌, can you check this one out? 

Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

Update: 

When I added the default values into the repeating section on the other task forms. They now came through. But the HTML is still not working...

Accept as Solution Reply
Workflow Hero

Re: Default Value in repeating section (first row - why!!)

Sorry ‌, I'm not sure on this one. I can try recreating in another enviro to see if I get the same behaviour?

0 Kudos
Accept as Solution Reply