how to code it to add a variable 'plan' as 'Work Notes'

SonnyY
Tera Contributor

The command from the code below: addPlanToIncident () is to add a variable 'plan' to 'Additional Comments'. Does any one know how to code it to add a variable 'plan' as 'Work Notes'?
sn_itsm_aia.InvestigatingAndResolvingIncidentsUtil().addPlanToIncident(givenIncidentNumber, plan);

 

 

This code below is used to create a variable 'plan' and add it to the 'Additional Comments'.

 

(function(inputs) {
    var plan = inputs['plan_to_add_array'];
var givenIncidentNumber = inputs['given_incident_number'];

    if(typeof plan == "string") {
try{
plan = JSON.parse(plan);
}catch(ex){
gs.error("Error while parsing plan to add as comments: {0}", ex);
return new sn_itsm_aia.InvestigatingAndResolvingIncidentsUtil().addPlanToIncident(givenIncidentNumber, plan);
}
    }
    plan = plan.map(function(step, index) {
        return step;
    }).join('\n');
    
    return new sn_itsm_aia.InvestigatingAndResolvingIncidentsUtil().addPlanToIncident(givenIncidentNumber, plan);
})(inputs);

0 REPLIES 0