- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2015 10:40 AM
I am trying to compare to see if the opened by and assigned to fields are the same in a client script. I keep getting the sysid of the fields and it doesnt seem like the comparison is correct. HOw can I compare these two values?
var open = g_form.getReference('opened_by')
var assigned = g_form.getReference('assigned_to')
if (newValue == 3 && open == assigned)
alert('success')
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2015 10:09 AM
Hi,
Try the below script if you just want to compare the display names.
var caler = g_form.getDisplayBox('caller_id').value;
var assig = g_form.getDisplayBox('assigned_to').value;
if(caler == assig)
{
alert('in');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2015 10:51 AM
getReference() gets you the entire gliderecord. Not sure if you can compare a whole gliderecord to gliderecord like that.
Try just getValue() instead. If that doesn't work, try evaluating open.name == assigned.name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2015 10:58 AM
oops sorry, I had tried getReference() after getValue() and accidentally posted the modified. I tried open.name and assigned.name and it worked. Thanks! not sure why comparing the ID's didnt work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2015 11:01 AM
Well if the variables are defined as getReference and then you just compare the variables, you're not comparing ID's. You're comparing the entire object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2015 08:44 AM
I thought open.name == assigned.name was working but when i was testing with other names it was still evaluating to true. I printed out each variable to see value and the reason this works is the variables are both undefined. This is in a client script and I don't think I can dot walk in a client script? Any ideas how I can evaluate each of these fields so when they are equal they are true?
I dont understand why the below wont work. I have printed out the values of open and assigned and the IDs are the same / not the same if they are different
var open = g_form.getValue('opened_by');
var assigned = g_form.getValue('assigned_to');
if(open == assigned)