- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2025 12:20 AM
need to check the logged in user title exact matches the title which i declared in system property.
example;- created a system property with title like "FC Manager,Field Service Technician II,Manager, Field Service,MOT DC Manager,Senior Manager, Field Service,Sr Fabricator,Sr Field Service Technician,Sr Service Technician,Supervisor-Field Service" , suppose logged in user title is "SERVICE TECHNICIAN", it should not satisfy the condition, only satisfy the condition when logged in user title is "Field Service Technician II" or "Sr Service Technician".
Please help me out.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2025 02:22 AM
then store that in a string variable, use split and it gives you array and then search in that array using indexOf.
But storing in property is recommended, considering in future if any title is added/removed then you need not change the script.
I believe I have provided enough guidance on 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2025 12:29 AM
you can get logged in user's title using this and then search in that array
var titleArray = gs.getProperty('propertyName').toString().split(',');
var loggedInUserTitle = gs.getUser().getTitle();
if(titleArray.indexOf(loggedInUserTitle) > -1){
// logged in user title is belonging to array
}
else{
// title not present
}
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
‎02-12-2025 01:01 AM
Hello @Ankur Bawiskar ,
It is not matching the exact name, suppose looged user title is "Field Service Technician" the system property has "Field Service Technician II" and "Sr Field Service Technician" so it is also going to yes condition but it should go to no.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2025 01:04 AM
it won't go inside that IF unless it finds.
then ensure system property holds the correct titles
share your complete script and testing results
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
‎02-12-2025 01:08 AM
Hello @Ankur Bawiskar ,
system property :- FC Manager,Field Service Technician II,Manager, Field Service,Field Service,Sr Fabricator,Sr Field Service Technician,Sr Service Technician,Supervisor-Field Service
-----------------------
Please try in your PDI