UI Builder Create Record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 02:03 AM
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
- Labels:
-
Now Experience UI Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2022 07:49 AM
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.
ServiceNow Community Rising Star 2022/2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2022 07:54 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 04:26 AM
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
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 04:02 AM
Thank you for sharing it ! How you find out that you need to us "^" as separator ?