How to call a decision table from email client template recipients To field

mfhaciahmetoglu
Mega Sage

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:

 

// Script Include (Client Callable)
var UserEmailUtil = Class.create();
UserEmailUtil.prototype = {
    initialize: function() {
    },

    getEmailAddress: function() {
        gs.info("is this working?");
        return "test@example.com";
    },

    type: 'UserEmailUtil'
};
 
To field:
mfhaciahmetoglu_0-1738768415033.png

 

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

 

 

2 ACCEPTED SOLUTIONS

Are the email client template and the script include in the same scope? The script include is not accessible form all application scopes.

View solution in original post

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

View solution in original post

18 REPLIES 18

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

Did you confirm that the template is in the same scope as the script include? The call to your script includes comes from that scope.

Yes, they are:

 

mfhaciahmetoglu_0-1738858023510.png

mfhaciahmetoglu_1-1738858058566.png

 

 

Hello again,

Okay, I implemented the same solution on DEV and it worked just fine, which means that indeed it was sandbox related. However, it is weird because even when I turn on "Sandbox callable" it did not work.

 

Thanks a lot for all help!

 

Best,

Firat