- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2020 07:47 AM
Hello again,
i need a little help with the email client.
I found some threads like (1 / 2) but i dont get it 100% working.
I got a column in incident "u_mail" with some choices. Different Email Client Templates with a condition to the u_mail.
If i choose "Antwortmail" for example, click on the default email button (more Options) the Email Template "Antwortmail" opens. So this is working fine.
I copied a macro, but missing is the correct URL (??? in macro) to open the Email Client.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a href="???" target="_blank" class="btn btn-default icon-mail"></a>
</j:jelly>
Or can i just copy the function from the default E-Mail Button (more options menue) to my button?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 05:14 AM
Hi,
Please refer below to fulfill requirement:
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate>
var table, sys_id;
table = RP.getParameterValue('jvar_ref_table');
sys_id = current.sys_id;
var url1="/email_client.do?sysparm_table=incident&sysparm_sys_id=" + sys_id + "&sysparm_target=incident&sys_target=incident&sys_uniqueValue=" + sys_id + "&incident.u_mail_1=";
</g2:evaluate>
<a href="$[url1]" id="temp_link" target="_blank" class="btn btn-default icon-mail" onclick="test(this)">AA</a>
<input type="hidden" id="url_value" value="$[url1]"/>
<script>
function test(a){
var url = document.getElementById("url_value").value;
a.href=url+g_form.getValue("u_mail_1");
}
</script>
</j:jelly>
--------------------------------------------------------------------
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 03:56 AM
unfortunately i have to. Like i said i already got different templates.
But when i click my custom mail button, template which matches condition, does not open. Just the default email template.
With the default button every is working fine and the template which matches value u_mail_1 will be opened
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 04:23 AM
Okay.
So as we are accessing server side value as current.u_mail_1, it does not give value modified on client side which is not saved to table yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 05:14 AM
Hi,
Please refer below to fulfill requirement:
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate>
var table, sys_id;
table = RP.getParameterValue('jvar_ref_table');
sys_id = current.sys_id;
var url1="/email_client.do?sysparm_table=incident&sysparm_sys_id=" + sys_id + "&sysparm_target=incident&sys_target=incident&sys_uniqueValue=" + sys_id + "&incident.u_mail_1=";
</g2:evaluate>
<a href="$[url1]" id="temp_link" target="_blank" class="btn btn-default icon-mail" onclick="test(this)">AA</a>
<input type="hidden" id="url_value" value="$[url1]"/>
<script>
function test(a){
var url = document.getElementById("url_value").value;
a.href=url+g_form.getValue("u_mail_1");
}
</script>
</j:jelly>
--------------------------------------------------------------------
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 06:03 AM
That's it, nice !!! Thank you. Maybe one last thing 🙂
The Email Client via my (your^^) custom button ist in a new tab with fullscreen.
The Email Client via default button is a new Window, not fullscreen.
I can live with that, but it is easy to change?
Thanks again and nice weekend
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2020 06:11 AM
Yes you can.
Refer below:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate>
var table, sys_id;
table = RP.getParameterValue('jvar_ref_table');
sys_id = current.sys_id;
var mail = current.u_mail_1.getDisplayValue(); // Not working
var url1="/email_client.do?sysparm_table=incident&sysparm_sys_id=" + sys_id + "&sysparm_target=incident&sys_target=incident&sys_uniqueValue=" + sys_id + "&incident.u_mail_1=";
</g2:evaluate>
<a href="$[url1]" id="temp_link" target="popup" class="btn btn-default icon-mail" onclick="test(this)">AA</a>
<input type="hidden" id="url_value" value="$[url1]"/>
<script>
function test(a){
var url = document.getElementById("url_value").value;
a.href=url+g_form.getValue("u_mail_1");
window.open(a.href,'popup','width=600,height=600,scrollbars=no,resizable=no');
}
</script>
</j:jelly>