- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 12:26 PM
I have 2 variables on a record producer. One is "account", the other is "contract".
Both are reference fields, customer_account & ast_contract.
Once the account is selected, I only want contracts related to that specific account to be shown on the contract reference variable. (There is an "account" field on the contract table)
I have done this before via calling a script include and passing the account variable and returning the sys_id's of the contracts I want to be shown in the contract variable:
The issue is I cannot pass record producer variables to the script include using this method for some reason.
Here are the errors:
com.glide.script.RhinoEcmaError: "current" is not defined.
<refname> : Line(1) column(0)
==> 1: new ProjectOverview().getAccountContracts(current.variables.account)
com.glide.script.RhinoEcmaError: "producer" is not defined.
<refname> : Line(1) column(0)
==> 1: new ProjectOverview().getAccountContracts(producer.variables.account)
com.glide.script.RhinoEcmaError: "producer" is not defined.
<refname> : Line(1) column(0)
==> 1: new ProjectOverview().getAccountContracts(producer.account)
As you can see producer.account, producer.variables.account, and current.variables.account are not working.
How can I pass the record producer's account variable to the script include using reference qualifiers? (See first screenshot)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 08:06 PM
Hi @JJG_SNOW
Your first try is the correct one.
new ProjectOverview().getAccountContracts(current.variables.account)
The root cause is because of the way you set the Reference Qualifier. Let's try to modify as following below.
javascript: "sys_id=" + new ProjectOverview().getAccountContracts(current.variables.account)
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 12:54 PM
Can you point it to g_form.getValue('account') ? Failing that, do an onChange script to run your script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 04:50 PM
Do it using an On change client script and then pass the variable value to the script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 08:06 PM
Hi @JJG_SNOW
Your first try is the correct one.
new ProjectOverview().getAccountContracts(current.variables.account)
The root cause is because of the way you set the Reference Qualifier. Let's try to modify as following below.
javascript: "sys_id=" + new ProjectOverview().getAccountContracts(current.variables.account)
Cheers,
Tai Vu