Is there any button to copy fields into another table?

ParkHyunSun
Tera Expert

Hi, 

I want to find a reference from ServiceNow OOTB button and utilize it, but cannot figure what to use.

Below is what I want to make.

 

1. In the requested item (sc_req_item), I will use short description, description.

ParkHyunSun_1-1705039670725.png

 

2. I want to create a button named "Make Knowledge" next to Save (Submit).

The Function of "Make Knowledge" is mapping the requested item's short description and description to Knowledge FAQ table's Short Descriptions and Questions.

ParkHyunSun_2-1705039998113.png

 

I think the similar button already exist in ServiceNow, but I cannot find what it is.

Is there anyone who can help me?

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Rahul Talreja
Mega Sage
Mega Sage

Hi @ParkHyunSun ,
 You can create a one:-

1. Navigate to System UI > UI Actions in ServiceNow.
2. Click on New to create a new UI action.
3. Fill in the mandatory fields:
- Name: Make Knowledge
- Table: sc_req_item
- Action name: make_knowledge
- List v2 Compatible: true (if you're using List v2)
- Form button: true
- Client: true
4. In the script section, you could write something like this:

function onClick() {
    var gr = new GlideRecord('kb_knowledge');
    gr.newRecord();
    gr.short_description = g_form.getValue('short_description');
    gr.text = g_form.getValue('description');
    gr.kb_knowledge_base = 'Your Knowledge Base sys_id';
    gr.kb_category = 'Your Category sys_id';
    gr.workflow_state = 'draft';
    gr.update();
    gs.addInfoMessage('Knowledge Article Created');
    action.setRedirectURL(current);


And you can also refer the link below:
https://docs.servicenow.com/bundle/vancouver-servicenow-platform/page/product/knowledge-management/t...


Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

View solution in original post

2 REPLIES 2

Rahul Talreja
Mega Sage
Mega Sage

Hi @ParkHyunSun ,
 You can create a one:-

1. Navigate to System UI > UI Actions in ServiceNow.
2. Click on New to create a new UI action.
3. Fill in the mandatory fields:
- Name: Make Knowledge
- Table: sc_req_item
- Action name: make_knowledge
- List v2 Compatible: true (if you're using List v2)
- Form button: true
- Client: true
4. In the script section, you could write something like this:

function onClick() {
    var gr = new GlideRecord('kb_knowledge');
    gr.newRecord();
    gr.short_description = g_form.getValue('short_description');
    gr.text = g_form.getValue('description');
    gr.kb_knowledge_base = 'Your Knowledge Base sys_id';
    gr.kb_category = 'Your Category sys_id';
    gr.workflow_state = 'draft';
    gr.update();
    gs.addInfoMessage('Knowledge Article Created');
    action.setRedirectURL(current);


And you can also refer the link below:
https://docs.servicenow.com/bundle/vancouver-servicenow-platform/page/product/knowledge-management/t...


Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi the docs you gave me helps a lot!

Thank you!