Skip to main content
Nintex Community Menu Bar
Question

Child Relationship Template html trouble

  • July 9, 2024
  • 12 replies
  • 58 views

Forum|alt.badge.img+18

A minor problem:

I set up a child relationship on a model. Everything’s working great, except that when I display the textarea field {{Nurse_s_Notes__c}} I get html paragraphs in the actual text:

Here’s the set-up:

I tried the triple mustache, to no avail.

Any ideas?

12 replies

Forum|alt.badge.img+13

What kind of field is Nurse_s_Notes__c ? Rich Text, or regular Small / Long Textarea? 


Forum|alt.badge.img+18
  • Author
  • July 9, 2024

Rich Text Area(32768)


Forum|alt.badge.img+13

Ok. Unfortunately, Skuid currently doesn’t do full “rendering” logic on Child Relationship fields, so thats why this is happening — Skuid is just spitting out the raw value for the Child Relationship field data. 


Forum|alt.badge.img+18
  • Author
  • July 9, 2024

So my options are…
1. Change the field to a long text instead of rich text
2. Do nothing and deal with the ugliness
3. Use a different method to display the field

Is that correct? Will #1 work?


Forum|alt.badge.img+13

Yes these are all options.

Here is an idea for #3: You could use a Custom Field Renderer to output the contents of the Child Relationship data. So here’s what you do:

  1. Drag in some random field, e.g. CreatedDate, Name, or whatever, into your Field Editor, where you want to show this data. Give this field a Custom Field Renderer Snippet called “NursesNotesChildRelationshipData” or something like that.
  2. Define a Snippet called “NursesNotesChildRelationshipData” with contents like this:
// CHANGE THIS to whatever your Child Relationship name is!!!
var CHILD_RELATIONSHIP_NAME = "Contacts"; 
var FIELD_ID = "Nurse_s_Notes__c";
var DELIMITER = '
';
var field = arguments[0],
    model = field.model,
    row = field.row,
    childRel = field.row[CHILD_RELATIONSHIP_NAME];
 $ = skuid.$;
var output = [];
if (childRel && childRel.records && childRel.records.length) {
    $.each(childRel.records,function(i,record){
        output.push(record[FIELD_ID]);
    });
    field.element.html(output.join(DELIMITER));
}

This should display your Rich Text properly.


Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Actually I think there is a simpler way.  Call it #4… 

There are two ways to populate a template that shows Children fields. 
1. Drag the children relationship item from your fields list into your page.   This way does not do any rendering as you have discovered. 
2. Add a template to the page from the components list and then use the following syntax. 

{{#Child_Object__r.records}}{{RichTextFieldName}}{{/Child_Object__r.records}}

This method does the rendering.  

No Javascript needed. 



Forum|alt.badge.img+18
  • Author
  • July 9, 2024

Thanks, guys.

I need to filter the child records, so I don’t think #4 will work. I decided to just create a model on the child object the conditions I needed, and throw in a field editor on that model, with some extra css to get it to look the way I want.


Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Actually - if you implement child relationship filters, sorts and limits in your model defintion. They will be respected using method #4.


Forum|alt.badge.img+18
  • Author
  • July 9, 2024

Nice!


Forum|alt.badge.img+18
  • Author
  • July 9, 2024

Are there any plans to perform rendering on child relationships fields? Otherwise, documenting Rob’s #4 method might be a good idea.

Thanks!


Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Definitely has been identified as needed.  Currently sitting in our backlog. 


Forum|alt.badge.img+10

@Matt Sones Me too!