- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2025 07:14 AM - edited ‎02-05-2025 07:15 AM
Hello,
Based on the "taxi company" field's choice list value, I want to return a different email address on Email Client Script > Recipients > To field.
Any ideas how can this be done?
One note related to this.
I have already created a script include to call from To field.
Script include:
For some reason this does not work. I see that gs.info is not displayed either.
Any ideas why? (my app is a custom app, so the scope is not global).
Best,
Firat
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:10 AM
Are the email client template and the script include in the same scope? The script include is not accessible form all application scopes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:57 AM
Hi @Sheldon  Swift ,
I made the script include accessible from all scopes and then used the scope API before calling, then it worked fine.
But it is still a mystery why it does not work when it is accessible only from the scope application 😕
Best,
Firat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:02 AM
I was able to solve the logs error by adding the API: javascript: new x_banv_request_t_0.UserEmailUtil().getRecipientsForTo(current); but still nothing returns. the script is not executed! Very weird 😕
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:10 AM
Are the email client template and the script include in the same scope? The script include is not accessible form all application scopes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:12 AM
Sorry, I accidentally clicked accept as solution and cannot undo it :/.
But yes they are in the same scope.
I am also doing this on the Sandbox instance. I came to know that there is a property called glide.script.use.sandbox: Run client generated scripts (AJAXEvaluate and query conditions) inside of a reduced rights "sandbox". If enabled, only those business rules and script includes with the "Client callable" checkbox set to true are available and certain back-end API calls are disallowed.
Can it be related to this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:23 AM - edited ‎02-06-2025 07:24 AM
The script sandbox property is enabled in my instance, so I'm not sure that's related. I've also recreated the client email template and script include in private scope and that is working as expected. If possible, I recommend recreating the client template and script include in the global scope and testing to determine if it is a scope issue.
Also, have you set an identifiable subject in the client email template, so you can easily see that it's being applied?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2025 07:30 AM
You are right, it is related to the scope. I called it successfully without even flagging as Sandbox callable and it worked just well on Sandbox. But for some reason, scope does not allow it. It is weird because both the script include and the client template are o the same scope!