- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 07:43 AM
I have a record producer with a lot of variables that go into the Description field. Currently it is formatted like option A. To make updating and visualizing what is in the Record Producer, I would like to format it like option B.
My question is... can I do it the way it is displayed in Option B?
Thank you!
OPTION A
current.description = 'Submitted By: ' + producer.opened_by.getDisplayValue() + '\nSubmitter Phone: ' + producer.str_phonenumber +'\nSubmitter Email: ' + producer.str_email + '\n' + '\n' + 'On Behalf of Name: ' + producer.u_on_behalf_of.getDisplayValue() + '\nOn Behalf of Phone: ' + producer.str_altphonenumber + '\nOn Behalf of Email: ' + producer.str_altemail + '\n' + ' '\nCategory: ' + producer.Category.getDisplayValue() + '\n' + '\nProblem / Issue :' + producer.str_question1 + '\nProposed Solution: ' + producer.str_question2;
OPTION B:
current.description = 'Submitted By: ' + producer.opened_by.getDisplayValue() +
'\nSubmitter Phone: ' + producer.str_phonenumber +
'\nSubmitter Email: ' + producer.str_email + '\n' + '\n' +
'On Behalf of Name: ' + producer.u_on_behalf_of.getDisplayValue() +
'\nOn Behalf of Phone: ' + producer.str_altphonenumber +
'\nOn Behalf of Email: ' + producer.str_altemail + '\n' +
'\nCategory: ' + producer.Category.getDisplayValue() + '\n' +
'\nProblem / Issue :' + producer.str_question1 +
'\nProposed Solution: ' + producer.str_question2;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 11:14 AM
Hi @claires ,
Try below one
current.description =
'Submitted By: ' + producer.opened_by.getDisplayValue() + '\n' +
'Submitter Phone: ' + producer.str_phonenumber + '\n' +
'Submitter Email: ' + producer.str_email + '\n\n' +
'On Behalf of Name: ' + producer.u_on_behalf_of.getDisplayValue() + '\n' +
'On Behalf of Phone: ' + producer.str_altphonenumber + '\n' +
'On Behalf of Email: ' + producer.str_altemail + '\n\n' +
'Category: ' + producer.Category.getDisplayValue() + '\n\n' +
'Problem / Issue: ' + producer.str_question1 + '\n' +
'Proposed Solution: ' + producer.str_question2;
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 08:19 AM - edited 11-01-2024 08:29 AM
\n by itself will not work. Try this format which works:
vstr = 'hello' + '\n\n' + 'there';
g_form.setValue('description',vstr);
Not directly related, but also worth knowing:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0791099
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 09:23 AM
I don't think I was clear enough. Currently, the Description Field of the ticket, it formats perfectly when like Option A.
I'm talking about in the body of the Record Producer, so that it is easier to read what is there and make any changes and additions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 11:14 AM
Hi @claires ,
Try below one
current.description =
'Submitted By: ' + producer.opened_by.getDisplayValue() + '\n' +
'Submitter Phone: ' + producer.str_phonenumber + '\n' +
'Submitter Email: ' + producer.str_email + '\n\n' +
'On Behalf of Name: ' + producer.u_on_behalf_of.getDisplayValue() + '\n' +
'On Behalf of Phone: ' + producer.str_altphonenumber + '\n' +
'On Behalf of Email: ' + producer.str_altemail + '\n\n' +
'Category: ' + producer.Category.getDisplayValue() + '\n\n' +
'Problem / Issue: ' + producer.str_question1 + '\n' +
'Proposed Solution: ' + producer.str_question2;
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand