copying field from case to incident

yunus shadman
Tera Contributor

i have a requirement to copy the field (category) from case to incident . i have written a BR for that 

(function executeRule(current, previous /*null when async*/ ) {
    var caseCP = new GlideRecord("incident");
     caseCP.addQuery("sys_id", current.incident);
    caseCP.query();
    if (caseCP.next()); {
        caseCP.u_asset = current.asset;
        caseCP.u_product = current.product;
        caseCP.category = current.category.toString();
        caseCP.impact = current.impact;
        caseCP.urgency = current.urgency;
        caseCP.contract = current.contract;
        caseCP.u_entitlement = current.entitlement;
        caseCP.u_ci_service_level = current.u_ci_service_level;
        caseCP.description = current.description;
        caseCP.short_description = current.short_description;
        caseCP.update(); //updates change
    }
})(current, previous);

 

 

but for category field it is showing string value in incident form instead of string value, i check for the category dictionary , it is showing type as integer in case form and integer in the incident form . how can i copy the field ..? 

 

5 REPLIES 5

i have already check this url , i dont have authorities to change the CSMIncidentIntegrations script include record . and as i mentioned that category choice val is there any alternate way to either by scripting or creating any properties , i am a  beginner for the scripting and servicenow . can you suggest me something which i can understand easily ..?