Did anyone have issues rendering inline HTML with ...
# suitescript
y
Did anyone have issues rendering inline HTML with suitescript 2.1? I am trying to use a script tag to manipulate the error message that is displayed to the user. When I do it in 2.0, it works perfectly. When I try 2.1, the HTML tags are converted to a string and the full message is displayed. Please let me know if you have any leads.
b
what does the code look like
y
var errorText = 'Please contact <mailto:ns.support@ggiinternational.com|ns.support@ggiinternational.com> to create a new customer.';
            
// throw errorText;
            
//err = error.create()
            
log.debug('errortext', errorText)
            
if (runtime.executionContext === 'USERINTERFACE') {
                
var msg = '\<style\> .text {display: none;} .bglt td { white-space:pre } .textboldnolink {display: none;} .bglt td:first-child:not(.textboldnolink)::after { color:black;font-size:16pt; font-weight: bold;display:block; content:\''+errorText+'\';display:block;}\</style\>'
            
} else {
                
var msg = errorText;
            
}
            
log.debug('message', msg)
            
// err.message = msg
            
// err.name = 'Access Restricted'
            
//err.notifyOff = true;
            
var err = error.create({
                
name: 'Access Restricted',
                
message: msg,
                
notifyOff: true
            
});
            
throw err;
b
i think you will need to compare the source of the 2 pages to each other
from what i can tell, this relies on breaking the html parser
the errors thrown by suitescript 2.1 and 2.0 are different
☝️ 1
mostly because errors are non standard between different javascript engines
y
thanks @battk i appreciate your response. Yes i did notice from comparing the source of both pages that the errors thrown in 2.1 are of a different format. the main difference that affects my code is that the "message" is stringified, so even a simple color or font change with the css style tag would just print like regular text. if you have any ideas how to get around this problem i would appreciate it.
b
usually you handle pretty errors with client script before the record is saved