How to copy the work notes

PRAGHATIESH S
Tera Expert

Hi,
I want to copy the work notes and comments from incident to Case when click on the "Create Case" ui button.
In the Ui action , we had some line of code to copy the work notes, but still its not copying. Anyone suggest what is the mistake 

current.update();

var newRecord = new GlideRecord("sn_customerservice_case");
newRecord.initialize();

if (!gs.nil(current.account))
    newRecord.setValue("account", current.getValue("account"));

if (!gs.nil(current.contact))
    newRecord.setValue("contact", current.getValue("contact"));

if (!gs.nil(current.consumer))
    newRecord.setValue("consumer", current.getValue("consumer"));

if (!gs.nil(current.short_description))
    newRecord.setValue("short_description", current.getValue("short_description"));

if (!gs.nil(current.opened_for))
    newRecord.setValue("internal_user", current.getValue("opened_for"));


if (!gs.nil(current.work_notes))
    newRecord.setValue("work_notes", current.getValue("work_notes"));

if(GlidePluginManager.isActive('com.snc.service_organization') && !gs.nil(current.req_service_org))
    newRecord.setValue("requesting_service_organization", current.getValue("req_service_org"));

if (GlidePluginManager.isActive('com.snc.csm_proxy_contacts') && !gs.nil(current.opened_for) &&
    current.opened_for.sys_class_name == "sys_user" && new sn_csm_proxy_cont.ProxyContactHelper().isUserProxyContact(current.getValue("opened_for")))
    newRecord.setValue("internal_contact", current.getValue("opened_for"));

if (current.getValue('type') == 'phone')
    newRecord.setValue('contact_type', 'phone');
if (current.getValue('type') == 'chat')
    newRecord.setValue('contact_type', 'chat');

if (GlidePluginManager.isActive("sn_csm_gen_ai")) {
    newRecord.insert();
    if (!gs.nil(current.work_notes))
    newRecord.setValue("work_notes", current.getValue("work_notes"));
}

action.openGlideRecord(newRecord);

// Tracks number of "Create Case" clicks on the Interaction form via CSM Agent Workspace
var csmWorkspaceUAUtil = new sn_csm_workspace.CSMWorkspaceUAUtil();
csmWorkspaceUAUtil.createCaseClickInteraction();

intRelUtil = new global.InteractionRelationshipUtil();
if (intRelUtil.copyAttachments !== undefined)
    intRelUtil.copyAttachments(current, newRecord);
4 REPLIES 4

Viraj Hudlikar
Tera Sage

Hello @PRAGHATIESH S 

 

Refer this thread Solved: How to copy worknotes from interaction to Incident... - ServiceNow Community

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards

Viraj Hudlikar.

PRAGHATIESH S
Tera Expert

its resolved now, thank you

@PRAGHATIESH S 

 

If my response helped, please mark it correct and close the thread so that it benefits future readers.

 

Thanks & Regards

Viraj Hudlikar.

VidishaMishra
Tera Contributor

Hi @PRAGHATIESH S ,
How did you resolve this?