I want to create UI macro on incident form

Rohit Reddy
Tera Contributor

I want to create UI macro and when user clicks on it, it should create a knowledge base article.

 

Please suggest your expertise.

1 ACCEPTED SOLUTION

Mahesh Baraskar
Mega Guru

MaheshBaraskar_0-1721983745331.png

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

 

 

<button id="button" onclick="kbCreate();">Post Knowledge</button>

<script>

 

function kbCreate(){

 

 

var gr= new GlideRecord('kb_knowledge'); gr.initialize();

gr.short_description = g_form.getValue('incident.short_description'); gr.text=g_form.getValue('incident.description');

 

 

gr.insert();

}

</script>

</j:jelly>

 

 

After creating this UI macro, write this line in the dictionary attributes of the incident reference field:

ref_contributions=create_kb

 

Please mark it as helpful if it solves your issue.

View solution in original post

1 REPLY 1

Mahesh Baraskar
Mega Guru

MaheshBaraskar_0-1721983745331.png

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

 

 

<button id="button" onclick="kbCreate();">Post Knowledge</button>

<script>

 

function kbCreate(){

 

 

var gr= new GlideRecord('kb_knowledge'); gr.initialize();

gr.short_description = g_form.getValue('incident.short_description'); gr.text=g_form.getValue('incident.description');

 

 

gr.insert();

}

</script>

</j:jelly>

 

 

After creating this UI macro, write this line in the dictionary attributes of the incident reference field:

ref_contributions=create_kb

 

Please mark it as helpful if it solves your issue.