Record Producer Formatting

claires
Tera Expert

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;

 

1 ACCEPTED SOLUTION

Anand Kumar P
Giga Patron
Giga Patron

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

View solution in original post

3 REPLIES 3

Paul Curwen
Giga Sage

\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

 

 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

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.

Anand Kumar P
Giga Patron
Giga Patron

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