Not able to populate reference field while opening a new record of knowledge article from UI action

Sushma Uday C
Tera Contributor

Hello All,

We have custom table where we have UI action (Create Knowledge Base) which should redirect to Knowledge article new record when clicked on it. we are able to navigate and populate the field from custom table form to knowledge article from. Once the knowledge article is created we wanted to show the article created from them has to shown in related list. so I have created a field(Instruct Model) on knowledge article form which is reference to field on a custom table. 

So now I want to populate the value from custom field to the reference field on article table .I am not able to auto populate the reference field with the value from field from custom field to relate the show in the related list .

 

UI Action:

SushmaUdayC_0-1665505192141.png

Expected result :

SushmaUdayC_1-1665505245470.png

When clicked on create knowledge button ,  we are able to populate other field value from custom table to article new page but  not able to populate the Experience ID with the experience ID from custom table:

SushmaUdayC_2-1665505621608.png

CC: @Ankur Bawiskar , Thanks in Advance.

1 ACCEPTED SOLUTION

Hello,

 

Please use the below code:- In place of replaceknowledgeexpidfieldname enter the backend name of the Experience ID field on knowledge table

 

function createKnowledgeBase() {

var mName = g_form.getValue('instruct_model_name');
var mUrl = g_form.getValue('instruct_model_url');
var nDesc = g_form.getValue('model_description');
var expid= g_form.getUniqueValue();

var link = '<a href= ' + mUrl + ' target=_blank>Click here to launch</a>';
var mImg = '<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/QR_code_for_mobile_English_Wikipedia.svg/2..."/>';

g_navigation.open("/kb_knowledge?sys_id=-1&sysparm_query=replaceknowledgeexpidfieldname="+expid+"^short_description= " + mName +
"^x_care3_carear_cus_instruct_model=" +mName +
"^text =" + '<h1> <strong> ' + mName + ' </strong></h1> ' +
'<br/>' + '<h2>' + nDesc + '</h2> ' +
'<br/>' + '<h2>' + link + '</h2> ' +
'<br/>' + mImg, "_blank");

  

Please mark my answer as correct based on Impact.

View solution in original post

4 REPLIES 4

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Is the code to copy from one table to other there in the UI action? Can you paste the complete code of the UI action so that we can have a look and assist you.

 

Thanks.

Hey ,

 

Yeah we are trying to copy values from custom table to Knowledge article new record form when we click on UI action. Where we are not able to copy a value from field in custom table to the reference field  on Knowledge article form. 

Note: Reference field on knowledge article is field referring to the same custom table which has UI action.

 

UI Action script.

function createKnowledgeBase() {

var mName = g_form.getValue('instruct_model_name');
var mUrl = g_form.getValue('instruct_model_url');
var nDesc = g_form.getValue('model_description');

var link = '<a href= ' + mUrl + ' target=_blank>Click here to launch</a>';
var mImg = '<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/QR_code_for_mobile_English_Wikipedia.svg/2..."/>';

g_navigation.open("/kb_knowledge?sys_id=-1&sysparm_query=short_description= " + mName +
"^x_care3_carear_cus_instruct_model=" +mName +
"^text =" + '<h1> <strong> ' + mName + ' </strong></h1> ' +
'<br/>' + '<h2>' + nDesc + '</h2> ' +
'<br/>' + '<h2>' + link + '</h2> ' +
'<br/>' + mImg, "_blank");

Custom Table : UI Action, We are passing values from this form, We are able to send experience name, URL and we want to display knowledge articles that will be created from this form should be shown in the related list.

SushmaUdayC_2-1665584843175.png

 

Knowledge Article: I want to copy experience ID from above screen shot to experience ID field in article form.

SushmaUdayC_3-1665585504687.png

 

 

 

 

 

 

Hello,

 

Please use the below code:- In place of replaceknowledgeexpidfieldname enter the backend name of the Experience ID field on knowledge table

 

function createKnowledgeBase() {

var mName = g_form.getValue('instruct_model_name');
var mUrl = g_form.getValue('instruct_model_url');
var nDesc = g_form.getValue('model_description');
var expid= g_form.getUniqueValue();

var link = '<a href= ' + mUrl + ' target=_blank>Click here to launch</a>';
var mImg = '<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/QR_code_for_mobile_English_Wikipedia.svg/2..."/>';

g_navigation.open("/kb_knowledge?sys_id=-1&sysparm_query=replaceknowledgeexpidfieldname="+expid+"^short_description= " + mName +
"^x_care3_carear_cus_instruct_model=" +mName +
"^text =" + '<h1> <strong> ' + mName + ' </strong></h1> ' +
'<br/>' + '<h2>' + nDesc + '</h2> ' +
'<br/>' + '<h2>' + link + '</h2> ' +
'<br/>' + mImg, "_blank");

  

Please mark my answer as correct based on Impact.

Murthy Ch
Giga Sage

Hi @Sushma Uday C 

I can see you are just passing only 3 fields but not the Experience ID field value.

Let me know if I misunderstood your code.

 

Thanks,
Murthy