- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 12:54 AM
Hi all,
For example, A and B are reference fields of incident. I want to compare A.a and B.b in client script, how can I do that?
I know g_form.getReference() but looks like only one reference field can be fetched.
Regerds,
Eric
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 01:06 AM
Hi,
Assuming you want to compare some other fields based on the reference field of A and B, you can do liek this.
var a = g_form.getReference("A"); //put correct field names
var b = g_form.getReference("B"); //put correct field names
if(a.your_field == b.your_field) {
//do something.
}
Mark the comment as a correct answer if it solves your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 01:14 AM
From a performance perspective, you'd be better off using an AJAX call which takes the 2 sys_id's as input as in Ankur's example. This will mean there will only be 1 round trip to the server instead of the 2 needed for getReference. It will also minimise the amount of data returned, getReference will return every field while an AJAX call will leave the data on the server and could just return a true or false.