Attach kb tab not appearing out on the incident ticket when using API

chercm
Mega Sage

when i try to use this patch command to update inc ticket  : 

{"work_notes": "[code]<a title='Warranty coverage details for SCI and DeSc computers' href='kb_view.do?sys_kb_id=e31486b5474321009db4b5b08b9a7164' >KB0000010 : Warranty coverage details for SCI and DeSC computers</a>[/code]"}

the tab for attached knowledge article does not come out : 

 

chercm_0-1702452561946.png

 

 

 

2 ACCEPTED SOLUTIONS

Tai Vu
Kilo Patron
Kilo Patron

Hi @chercm 

You can try the Table API. Let's put the table name as "m2m_kb_task" and the body with the task and knowledge sys_id, it should work.

Sample below.

POST https://<instance_name>/api/now/table/m2m_kb_task

 

 Body

{
    "task": "<task_sys_id>",
    "kb_knowledge": "<knowledge_article_sys_id>"
}

 

Timi_0-1702523575695.png

Timi_1-1702523602574.png

 

Cheers,

Tai Vu

View solution in original post

Hi @chercm 

Yes the task_sys_id above is the record sys_id. There's a couple of ways that you can retrieve the record sys_id.

Timi_0-1703043436828.png

Timi_1-1703043468384.png

 

If you're using scripting with GlideRecord query, you can dotwalk sys_id or use the API getUniqueValue().

 

Also, in the Request Body at the task attribute, you can enter the Incident Number. It should work as well.

 

Cheers,

Tai Vu

View solution in original post

7 REPLIES 7

@Timi can i check how can i get the task information ?

@Tai Vu can i check how to get the task id ?

 

i do not see any mentioned of any incident sysid number. 

Hi @chercm 

Yes the task_sys_id above is the record sys_id. There's a couple of ways that you can retrieve the record sys_id.

Timi_0-1703043436828.png

Timi_1-1703043468384.png

 

If you're using scripting with GlideRecord query, you can dotwalk sys_id or use the API getUniqueValue().

 

Also, in the Request Body at the task attribute, you can enter the Incident Number. It should work as well.

 

Cheers,

Tai Vu