cmdb_ci name is giving empty value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 11:47 PM - edited 09-03-2024 10:52 PM
I have created a outbound rest api for problem.
When a new problem record is created this api will be triggerd in the buisness rule.
Everything is working fine but cmdb_ci name is not working.
I have tried current.cmdb_ci.getDisplayValue() also but didn't work.
code in the business rule:
(function executeRule(current, previous /*null when async*/ ) {
try {
var r = new sn_ws.RESTMessageV2('Problem API', 'Create ');
r.setStringParameterNoEscape('state', current.state);
r.setStringParameterNoEscape('problem_statement', current.short_description);
r.setStringParameterNoEscape('assignment_group', current.assignment_group.getDisplayValue());
r.setStringParameterNoEscape('number', current.number);
r.setStringParameterNoEscape('cmdb_ci', current.cmdb_ci.name);
r.setStringParameterNoEscape('description', current.description);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
current.description += 'Problem data sent to API: ' + responseBody;
gs.info('Problem API: ' + responseBody);
current.update();
} catch (ex) {
var message = ex.message;
gs.error('Problem API: '+ message);
}
})(current, previous);
EDIT:
I found there was a space in the api variable name. Fixed it.
0 REPLIES 0