Need to update the location based on the Short description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 04:24 AM
we have short description like [S1871R02] and we need to update the 1871 into the location field in incident.
we wrote script already but when we try to update the incident location is not matching with short description.
Business Rule script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 09:40 AM
@Brad Bowman yes we have M0516 location record but in incident its updating as M1203
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 10:34 AM
So then back to the script logs. Are you seeing "numericPart: 0516"? And you're still not seeing "Location found: ...."? Are you seeing "Location not found..."
It wouldn't hurt to force numericPartMatch to a string and append the 'M' there so that you know for certain what the GR query is searching for:
var numericPart = "M" + numericPartMatch[1].toString();
...
locRef.addQuery("name", numericPart);
confirm the log for numericPart is M0516, then see if the GlideRecord query finds this record. If it still doesn't, try a different location record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 10:59 AM - edited 10-03-2023 11:02 AM
we are able to get logs for numeric Part as M0516 after adding
Var numeric Part = "M" + numericPartMatch[1].toSting();
but we didn't get logs on Locationfound:
var locRef = new GlideRecord("cmn_location");
locRef.addQuery("name", numericPart);
locRef.query();
if (locRef.next()) {
gs.info("Location found: " + locRef.name);
this is not working we didn't get any logs for Location found
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 11:14 AM
Now were back/down to there must not be a record on the Location table with the Name exactly = "M0516". Maybe there's an initial or trailing space in the Name or the zero is a letter O?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 03:43 AM