Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 02:25 AM
Hi,
I would suggest to avoid using reserved keywords like string, gr, gs etc in server side scripts.
Also put try catch to know/handle exceptions.
(function executeRule(current, previous /*null when async*/ ) {
//incident description is {"Impact":"SERVICES",<a target=\"_blank\" href=\"http://www.google.com\">Open in Browser</a></p>","ProblemID":"P-1234"}
try{
var desc= current.description.toString();
gs.info('Descriptin is : '+desc);
if (desc.indexOf('{"Impact":"SERVICES"') > -1) {
var body = desc.split('href=\"'); //find to spilt
body = body[1].split('\">Open'); //end split
body = body[0].toString(); // This is the string
gs.log(body, 'test');
}catch(e){
gs.error('Exception in BR : '+e);
}
})(current, previous);
Also put more logs and see what values you are getting.
Thanks,
Anil Lande
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande
Thanks
Anil Lande