Update link of 'Attach to Case' Button

Saul6
Tera Guru

Hi,

Has anyone been able to change the link that gets populated in the comments after clicking the 'Attach to Case' button on the KB pop-up?

 

1. Open the 'related search'

Saul6_0-1707260276058.png

2. find a KB and press either on 'Attach' button OR if you click into the KBA, you should see 'Attach to Case'

Saul6_1-1707260360269.png

3. After clicking, this gets populated automatically in the comments, we want to change the link to something else but aren't sure where to change it

Saul6_2-1707260392764.png

 

Thanks in advance for the help.

 

Best,

Saul

1 ACCEPTED SOLUTION

Saul6
Tera Guru

Solution was to create a client script:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0717995

 

 

1. The Knowledge Article Link is populated from the Script include cxs_knowledge which is read-only and cannot be edited.

2. However, we can still modify the link by creating an onChange Client Script on the comments field which is populated with the Knowledge Article link when we click the “Attach” button from the contextual search results.

3. Here is an Example client script on Comments fields for overriding the link to view in Portal:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

  if (isLoading || newValue === '') {

  return;

  }

  if(newValue.includes('kb_view')){

     g_form.setValue('comments', newValue.replace('kb_view.do?sys_kb_id', 'sp?id=kb_article&sys_id'));

     }

  } 

View solution in original post

1 REPLY 1

Saul6
Tera Guru

Solution was to create a client script:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0717995

 

 

1. The Knowledge Article Link is populated from the Script include cxs_knowledge which is read-only and cannot be edited.

2. However, we can still modify the link by creating an onChange Client Script on the comments field which is populated with the Knowledge Article link when we click the “Attach” button from the contextual search results.

3. Here is an Example client script on Comments fields for overriding the link to view in Portal:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

  if (isLoading || newValue === '') {

  return;

  }

  if(newValue.includes('kb_view')){

     g_form.setValue('comments', newValue.replace('kb_view.do?sys_kb_id', 'sp?id=kb_article&sys_id'));

     }

  }