- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 11:18 AM
Hi. I am attempting to create an advanced reference qualifier that runs when another field changes (before saving) but have been unsuccessful, as it only seems to run onload, not onchange. For example (only an example, what I'm trying to do is more complex), let's say I have two reference fields: states of the country (i.e. Alaska, Arkansas, etc.) and counties of the state. When the user changes the state, the reference qualifier should run and show only the counties in the state I have chosen. But the reference qualifier only seems to run after a save (onload). As mentioned earlier, what I'm trying to do is far more complex than this example and I need to run javascript on the server each time a field is changed. The main issue is how do I get a reference qualifier to run onchange before a save. Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 02:15 PM
Yes it works for me
Ref qualifier: javascript:new FillServers().pickServers(current)
SI: Client callable checked
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 12:17 PM
You just need to return the sys_ids for the reference fields.
Share your script include script here, i'll see if i can help
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 12:46 PM
Prateek, I'm not following you. We are now talking about two different things: a reference qualifier script vs. an onChange gladeAjax call. These are entirely different things. If an onChange glideAjax call returns sys_ids, what would I do with the sys ids when they are returned to my callback function in the onChange? Of course, I could have the reference qualifier script return sys_ids, but as stated earlier, the reference qualifier script doesn't run onChange, only when the form loads. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 12:54 PM
My bad, misunderstood. Are you passing the dependant value in your reference qualifier condition?
javascript: new ScriptIncludeName().functionName('yourChangedValue');
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 01:04 PM
No worries. The answer to your latest question is no. All I'm doing is testing to see when the server script executes with plans to put more stuff in later. So I included no parameters:
javascript: new MySI().test1();
And on the server side, I have:
function test1() {
gs.info("reached test1");
}
When I search the logs, I see that entries are only made onload not when I change the field. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 01:06 PM
pass in the parameter that you want this script to run on, eg: if states needs to show up pass in country value
new MySI().test(current.variable);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks