
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 04:58 AM
I have a currency type field in pm_project table. On GlideRecord of this table, I would like to check null/0 value on the currency field.
Could you please help?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2019 02:52 AM
Hi,
Thanks for the suggestions, I was looking for value check in addQuery of GlideRecord. Below simple code worked fine:
var projectGR = new GlideRecord('pm_project');
projectGR.addQuery('cost','!=','0'); //check Total Planned Cost
projectGR.query();
Here, cost(Total planned cost) is the Currency field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 05:04 AM
Hi there,
Can you simulate that through a list (I would think Yes)? If so, this might help:
Utilizing the breadcrumb on lists to generate your query
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 05:09 AM
try with below code.
var gr = new GlideRecord('pm_project');
gr.query();
while(gr.next()){
if(gr.<currency field name> == null || gr.<currency field name> == 'USD;0'){
gs.print(gr.number);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 06:36 AM
Hi there,
Value stored in currency field is as below:
so you will have to write code considering this value.
for example:
if(gr.<filedname> == null || gr.<filedname> == 'USD;0.00')
If this resolves your query, please mark my comments as correct and helpful .
Regards,
Ajay Chavan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 07:55 AM
Last I checked, which was today, Currency fields always return zero even when they are null/empty so you can just do
if(gr.getValue("field") == 0)
and that will take care of having to worry about the currency used.