data collection error i am using pa script to find the diffrence of two fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2025 12:59 AM
What i am trying to do is find the difference of two fields time event starts and time event ends both are in string format value is 6am and 5pm now for calculation of diffrence of these two and find the hours in between them i have written a script which is throwing this error can anyone tell me what can be the possible reason for it
Script -
Error - during JavaScript evaluation: Not all references of "current" are passed in by "arguments" script: var gd = new GlideDateTime(current.time_event_starts); var gc = new GlideDateTime(current.time_event_ends); var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();}; var days=function(x,y){return diff(x,y)/(24*60*60*1000);}; days(current.time_event_starts,current.time_event_ends);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2025 10:03 AM
Hi @sasharma815
Consider these corrections:
1. This means your script is being executed in a calculation / script field (like in an indicator source or metric script) where the engine doesn’t automatically give you the full current object like in a Business Rule.
So when you directly write current.time_event_starts, the script evaluator complains.
Fix: You should only use the arguments passed into the script (for example, if it’s an indicator/score calculation, you only get values, not the full GlideRecord).
2. String format (“6am” / “5pm”)
GlideDateTime doesn’t understand “6am” or “5pm” directly. You need to parse them into a standard time format like HH:mm:ss or yyyy-MM-dd HH:mm:ss.
