Code showing in single line

SD2024
Tera Expert

Why does code show in a single long line in some screens? An example is the UX Style Colors form where I was editing the menu background colour. How do I get it to show multiple lines so that it's more easily readable and shows the different line numbers, like it does in client scripts?

VL2024_0-1733262018173.png

 

3 REPLIES 3

Shubham_Jain
Mega Sage

@SD2024 To improve the readability of your code in ServiceNow and show it on multiple lines (with line numbers and proper formatting), make sure to switch to the Script Editor where available. You can also manually format the code with line breaks and indentation or use an external code editor to format your code and then paste it back into the field. This will help you manage the code more easily and make the editing process more efficient.

✔️ If this solves your issue, please mark it as Correct.


✔️ If you found it helpful, please mark it as Helpful.



Shubham Jain


PrashantLearnIT
Giga Sage

Hi @SD2024 

 

This is an expected behavior for the style field, we need to format it according to our needs. As auto-formatting for this style field is not available.

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************

Juhi Poddar
Kilo Patron

Hello @SD2024 

To format the style , copy the code in script background and format it. 

Note: create a variable obj and store the style to it before formatting to avoid getting error.

Example: 

JuhiPoddar_0-1733293263000.png

This will format the style and same can be copied back to UX style.

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"

 

Thank You
Juhi Poddar