Skip to main content
Nintex Community Menu Bar
Question

Apostrophe turns into ' in Salesforce Name field

  • July 9, 2024
  • 9 replies
  • 98 views
  • Translate All

Forum|alt.badge.img+9


I have a simple Opportunity Name field on my page, and when the user enters an apostrophe it looks like the picture above. Is there a way to fix that? I am using a custom field renderer that looks like this:

var field = arguments[0], value = skuid.utils.decodeHTML(arguments[1]),
$ = skuid.$;
if(value != null){
field.mode = ‘read’;
}
skuid.ui.fieldRenderers[field.metadata.displaytype]field.mode;

This topic has been closed for replies.

9 replies

Forum|alt.badge.img+13

Moshe, could you post / send us the full XML for your page? What is the content of the “Template” property of your Page Title component? 

Could it be that a “New Opportunity” Skuid page you have created is actually causing the issue, since based on your Custom Field Renderer it would be impossible from this page to ever change the Opportunity Name? Is this page used as a Opportunity Detail page?

Translate

Forum|alt.badge.img+9

I’m using {{{Name}}} in the page title, it is a new opportunity page.

Translate

Forum|alt.badge.img+13

Change {{{Name}}} to {{Name}}. Triple-mustached fields are spitting out the raw data for a field, whereas double-mustache syntax is spitting out the HTML-encoded data. 

Translate

Forum|alt.badge.img+9

I just tried that and it didn’t work.

Translate

Forum|alt.badge.img+13

I noticed from your Page XML that there are other Custom Field Renderers that affect the value of the Opportunity Name field, in addition to the one you posted above. If you remove all of these Custom Field Renderers, does the problem persist?

Translate

Forum|alt.badge.img+9

Hey Zach thanks for looking into that, I just realized that there is a point during the save process where I am adding info onto the name, like so:

var currentName = opportunityModel.getFieldValue(row,‘Name’);   
if(currentName != null){
       opportunityModel.updateRow(row,‘Name’,currentName + ’ - ’ + commodity); 
    }
Do you know why that would change the behavior of the Name field.

Translate

Forum|alt.badge.img+9

If I comment out that line the apostrophe appears normally! However is there a way I can get around that because I would still like to update the Opportunity Name…

Translate

Forum|alt.badge.img+13

Yes, change it to this:

var currentName = opportunityModel.getFieldValue(row,'Name',<b>true</b>);&nbsp; &nbsp;<br>if(currentName != null){<br> opportunityModel.updateRow(row,'Name',currentName + ' - ' + commodity);&nbsp;<br>}


The important thing is that 3rd parameter to .getFieldValue(), where we request the UN-ESCAPED value of the field. If you don’t pass in the third parameter true, then you get the ESCAPED value of the field. We do this as a protection against XSS injection, since often people will just use getFieldValue() and dump the value directly to the screen, which could constitute an XSS vulnerability.  

Translate

Forum|alt.badge.img+9

Thanks that works!

Translate