- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 12:17 AM
Hi
I have requirement populate all fields data into single field type HTML when the record insert or update
For example I have category, subcategory, description fields and need populate all fields into artilcle body(html type) field like below shown
Category : Hardware
subcategory: CPU
Description: This is hardware issue
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 12:26 AM - edited 09-28-2023 04:33 AM
Hi @Brahmi Pandla,
You could use something like this, depending on where you where planning of using it of course:
var body = '';
body += '<p>Category: ' + current.getDisplayValue('category') + '</p>';
body += '<p>Subcategory: ' + current.getDisplayValue('subcategory') + '</p>';
body += '<p>Description: ' + current.getDisplayValue('description') + '</p>';
current.body = body;
Edit: Adjusted to show the right answer.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 02:36 AM
Hi @Brahmi Pandla,
Just tested it. Seems that </br> get removed.
It works like this:
var body = '';
body += '<p>Category: ' + current.getDisplayValue('category') + '</p>';
body += '<p>Subcategory: ' + current.getDisplayValue('subcategory') + '</p>';
body += '<p>Description: ' + current.getDisplayValue('description') + '</p>';
current.body = body;
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 06:46 AM
Hi @Brahmi Pandla,
Did you try the last script I provided?
It's working as expected for me.
var body = '';
if (current.getDisplayValue('category')){
body += '<p>Category: ' + current.getDisplayValue('category') + '</p>';
}
if (current.getDisplayValue('subcategory')){
body += '<p>Subcategory: ' + current.getDisplayValue('subcategory') + '</p>';
}
if (current.getDisplayValue('description')){
body += '<p>Description: ' + current.getDisplayValue('description') + '</p>';
}
current.body = body;
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 02:36 AM
Hi @Brahmi Pandla,
Just tested it. Seems that </br> get removed.
It works like this:
var body = '';
body += '<p>Category: ' + current.getDisplayValue('category') + '</p>';
body += '<p>Subcategory: ' + current.getDisplayValue('subcategory') + '</p>';
body += '<p>Description: ' + current.getDisplayValue('description') + '</p>';
current.body = body;
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 04:52 AM
Thanks Peter, it is working fine.
one more requirement here i want only populate filled fields only , Empty fields don't want populate
Example
Category : Hardware
subcategory:
Description: This is hardware issue
Now I want pupulate
Category: Hardware
Description: This is hardware issue
Please help on this much appreciated, Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 04:54 AM
I wrote the script like below it is populating value in single line
(function executeRule(current, previous /*null when async*/ ) {
if (current.number != '') {
var a = 'Number ' + ':' + current.number;
gs.info('aawer' + a);
}
if (current.requested_by.getDisplayValue() != '') {
var b = 'Requested by ' + current.requested_by.getDisplayValue();
gs.info('aawer1' + b);
}
current.article_body = a + '\n' + b;
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 04:55 AM
Hi @Brahmi Pandla,
No problem:
var body = '';
if (current.getDisplayValue('category')){
body += '<p>Category: ' + current.getDisplayValue('category') + '</p>';
}
if (current.getDisplayValue('subcategory')){
body += '<p>Subcategory: ' + current.getDisplayValue('subcategory') + '</p>';
}
if (current.getDisplayValue('description')){
body += '<p>Description: ' + current.getDisplayValue('description') + '</p>';
}
current.body = body;
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 05:16 AM
Hi Peter
I want populate only filled fields
Category: Hardware
Description: This is hardware issue
Here subcategory empty I don't want populate filed name also
but your code getting like below
Category: Hardware
Subcategory:
Description: This is hardware issue