Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Removing HTML from Description in Case Record

$
0
0

We're leveraging the auto record creation with a rule that creates a Case when an email is sent to the "help desk" queue. The rule is working great, with one exception. Incoming emails are formatted in HTML so all of the body tags and nonbreaking space characters are showing up making the Case Description almost impossible to read. I've added some JavaScript to remove the HTML with some regular expressions, but it leaves behind a ton of white space. I've tried using the native .trim() function to no avail. I've even tried to use the native .replace() function with disappointing results. Has anyone ever ran across this issue and how did you solve it? I'm tearing my hair out here...

Here is the code I used.

var regex = /(&nbsp;|<([^>]+)>)/g
body = Xrm.Page.getAttribute("description").getValue();
result = body.replace(regex, "");
Xrm.Page.getAttribute("description").setValue(result);

Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>