The CreatorCon Call for Content is officially open! Get started here.

when I Copy data from HTML field to String type field on Problem record I get "'"

sd khaja
Tera Contributor

I'm trying to copy cause notes and fix notes to close notes on the problem record when the state changes to resolve. cause notes and fix notes both are HTML-type fields, and close notes is a String-type field.  if you add any special characters in either of these fields - with text from both of these fields are added to the close notes when a Problem is set to Resolved it adds an ampersand & instead of what ever special character it is - e.g. an apostrophe 

 

Business rule: Before - update

Condition: State "is" Resolved

 

var cn = current.cause_notes.getValue();
cn = cn.replace(/<\/?[^>]+(>|$)/g, "");
 
var fn = current.fix_notes.getValue();
fn = fn.replace(/<\/?[^>]+(>|$)/g, "");
 
current.close_notes = cn + '\n' + fn; 
 
Cause notes: this is a test case.
Fix Notes: Copy user's data. 
Close notes:
this is a test case.
Copy user&#39;s data.
 
please let me know how to fix this issue, Thanks in advance.
1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @sd khaja 

no need for regex expression magic which doesn't work at the end. Instead use for example:

var cn = new GlideSPScriptable().stripHTML(current.cause_notes.getValue());

  Maik

View solution in original post

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi @sd khaja 

no need for regex expression magic which doesn't work at the end. Instead use for example:

var cn = new GlideSPScriptable().stripHTML(current.cause_notes.getValue());

  Maik

Hi @Maik Skoddow, Thanks for your response. That is working fine in my PDI but not in my company instance. I'm not sure what the issue is in my instance if you have any idea please let me know. Thanks.

Hi @sd khaja 

only you can know what the differences between your PDI and your company instance are as I have no access to it!

If you want to hear some ideas, you have to provide way more details and context information.

Maik