- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 12:07 AM
Hi,
I want to get the position of '/' in a text using the glidefunction:position().And then want to use it in substring.
Tried to escape the value but it returns error/garbage value. I cannot use other javascript functions because only basic functions are included in reports.
Code:
glidefunction:substring(category,'0',position('/',category))
Eg. I have string - 'Network Services / VPN / Cloud'
So after the code execution I want to display only - 'Network Services'
How can we do this ? Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 02:40 AM
@Community Alums
try this
glidefunction:substring(category, '1', glidefunction:subtract(position('/', category), '1'))
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-09-2025 01:04 AM
Hi @Community Alums ,
Can you try this :
glidefunction:substring(category, 0, glidefunction:position(category, '/'))
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 02:13 AM
I tried the solution, but its giving syntax error.
glidefunction:substring(category, 0, glidefunction:position(category, '/'))When I removed glidefunction keyword before position, then syntax error got correct. But still it did not give the expected output. I tried below codes:
glidefunction:substring(category, 0, position(category, '/'))glidefunction:substring(category, 0, position( '/',category))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 02:40 AM
@Community Alums
try this
glidefunction:substring(category, '1', glidefunction:subtract(position('/', category), '1'))
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-10-2025 11:19 PM
@Community Alums
Hope you are doing good.
Did my reply answer your question?
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
