UI Builder Create Record

Tadz
Tera Guru
Tera Guru

Hi Everyone,

I'm using ui builder create record operation.

In my client script i have these:

api.data.create_record_1.execute({
		'table': 'kb_social_qa_question',
		'templateFields': templateFields,
		'useSetDisplayValue' : false
	});

Somehow if i have text inside a quotation it will not properly read the templatefields.

can we specify in the parameters the field name directly instead?

Thanks,

Tads

8 REPLIES 8

JagjeetSingh
Kilo Sage
Kilo Sage

Hi,

The templateFields property takes the inputs as an encoded query.

How are you setting the fields? I mean what is the value of your variable templateFields.

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You may need to try escaping special characters in the encoded query in the template fields. Could you share the value you're passing there?

I made it like this.

I input value for question_details like

The "quick" brown 'fox' jumps over the lazy dog.

the templateFields string will be broken.

	var templateFields =  'kb_knowledge_base=777c717887e01d109508c8480cbb3548^kb_category=b50d75b887e01d109508c8480cbb3572';
		templateFields = templateFields + '^profile='+profile;
		templateFields = templateFields + '^question='+question;
		templateFields = templateFields + '^question_details='+stringWithBrs;
		
		templateFields = templateFields.toString();
		
	api.data.create_record_1.execute({
		'table': 'kb_social_qa_question',
		'templateFields': templateFields,
		'useSetDisplayValue' : false
	});

Thank you for sharing it ! How you find out that you need to us "^" as separator ?