How to remove double spaces for a field in the form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-18-2023 05:58 AM
Hi Team,
I have 2 string field in my form. Fund Name and Fund Number. How can I clean up the the existing this 2 field with leading double spaces?
Please suggest the way and a example code
Regards,
Sruthi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-18-2023 06:26 AM
no need of those 2 variables
var gr = new GlideRecord('table_name');
gr.query();
while (gr.next()){
gr.field_name1 = gr.field_name1.trim();
gr.field_name2 = gr.field_name2.trim();
gr.update();
}
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-18-2023 07:51 PM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-19-2023 01:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-19-2023 02:07 AM
try to use toString() before using trim() method
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-22-2023 09:50 AM
Hi Ankur,
Thanks for the response. It's working when I add string().
Can you please help me how to remove extra space in between 2 strings
Example - Testing Test (If in between Testing and Test 2 spaces then how to remove the one space)
Please suggest.
Regards,
Sruthi