Code showing in single line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 01:50 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 08:40 PM
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 08:53 PM
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
********************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 10:23 PM
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:
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