check if string begins with XYZ

Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2008 02:04 AM
Hi, I want to check in a business rule if a string begins with three specific characters. I thought I had read somewhere in the wiki how to do this, but can't find it anymore.
Can anyone assist please?
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2008 07:22 AM
Sounds like what you want is to get a list of all incidents in your system whose subtype starts with REQ or TRB. You can do that with a query
var rec = new GlideRecord('incident');
var term = rec.addQuery('u_incident_subtype', 'STARTSWITH', 'REQ');
term.addOrCondition('u_incident_subtype', 'STARTSWITH', 'TRB');
rec.query();
while (rec.next())
do something