Record exists using GlideRecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 04:00 AM
Hi,
I am connecting to external app using REST and am parsing the response. Before inserting into CMDB, I want to check if the record exists and am trying to use this query.
var isinsert=false;
var commrecord = new commrecord("cmdb_ci_comm");
commrecord.addQuery("asset_tag",parsed_object.AssetNumber);
commrecord.query();
//gs.log(" isinsert "+isinsert);
if(commrecord.next()){
isinsert=false;
}else{
isinsert=true;
commrecord.initialize();
}
If I execute this script as background script hard coding the asset number, it works perfectly. While parsing the REST response, it always says its a new record and inserts duplicate records.
Any help here is appreciated,
- Labels:
-
Integrations
-
Now Platform App Engine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 07:20 AM
Hi,
which value from json you want to parse and you want to query that against which field of table?
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader