- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 09:16 AM - edited 05-26-2025 09:16 PM
Looking for help to create UI Action which redirect the user on URL of email(Similar the way by clicking on three dot "...") with the current sys id via a UI Page.
var sysId = g_form.getUniqueValue(); // Get current record sys_id
var url = 'https://xyz/email_client.do' +
'?sysparm_table=sn_shop_purchase_requisition' +
'&sysparm_sys_id=' + sysId +
'&sysparm_target=sn_shop_purchase_requisition' +
'&sys_target=sn_shop_purchase_requisition' +
'&sys_uniqueValue=' + sysId +
'&sys_row=0' +
'&sysparm_encoded_record=' +
'&sysparm_domain_restore=false' +
'&sysparm_stack=no';
window.open(url, '_blank'); // Open URL in new tab
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 09:35 AM
Hi @Ayushi Saxena
Please use below code in ui action and ui page
UI Page : compose_email
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div id="email_preview">
<iframe src='email_client.do?sysparm_table=incident&sysparm_sys_id=${sysparm_id}&sysparm_target=incident&sys_uniqueValue=${sysparm_id}&sys_row=0&sysparm_encoded_record=&sysparm_domain_restore=false&sysparm_stack=no' id='send_email_iframe' width='100%' overflow-y='hidden' overflow-x='auto' frameborder='0' title="${gs.getMessage('Preview Email')}" style="background-color: white"/>
</div>
</j:jelly>
UI Page : Client Script
$j('#send_email_iframe').on('load', function() {
adjustIFrameSize($j(this));
});
function adjustIFrameSize(iframe) {
var height = 0;
if (isMSIE9 || isMSIE10) {
height = iframe.contents().find('body').outerHeight(true);
} else {
height = iframe.contents().height();
}
iframe.height(height);
iframe.width(iframe.parent().width());
}
UI Action : create client type ui action and use composeEmail() function name
function composeEmail() {
var sysId = g_form.getUniqueValue();
// var msg = " Send Email";
var sendEmail = new GlideModal("compose_email");
//sendEmail.setTitle(msg);
sendEmail.setWidth(800);
sendEmail.setPreference('sysparm_id', sysId); //pass the sys_id;
sendEmail.render();
}
Output :
If I helped you with your case, please click the Thumb Icon and mark as Correct.
Thanks and Regards
Krishnamohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 09:35 AM
Hi @Ayushi Saxena
Please use below code in ui action and ui page
UI Page : compose_email
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div id="email_preview">
<iframe src='email_client.do?sysparm_table=incident&sysparm_sys_id=${sysparm_id}&sysparm_target=incident&sys_uniqueValue=${sysparm_id}&sys_row=0&sysparm_encoded_record=&sysparm_domain_restore=false&sysparm_stack=no' id='send_email_iframe' width='100%' overflow-y='hidden' overflow-x='auto' frameborder='0' title="${gs.getMessage('Preview Email')}" style="background-color: white"/>
</div>
</j:jelly>
UI Page : Client Script
$j('#send_email_iframe').on('load', function() {
adjustIFrameSize($j(this));
});
function adjustIFrameSize(iframe) {
var height = 0;
if (isMSIE9 || isMSIE10) {
height = iframe.contents().find('body').outerHeight(true);
} else {
height = iframe.contents().height();
}
iframe.height(height);
iframe.width(iframe.parent().width());
}
UI Action : create client type ui action and use composeEmail() function name
function composeEmail() {
var sysId = g_form.getUniqueValue();
// var msg = " Send Email";
var sendEmail = new GlideModal("compose_email");
//sendEmail.setTitle(msg);
sendEmail.setWidth(800);
sendEmail.setPreference('sysparm_id', sysId); //pass the sys_id;
sendEmail.render();
}
Output :
If I helped you with your case, please click the Thumb Icon and mark as Correct.
Thanks and Regards
Krishnamohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 06:09 AM - edited 06-17-2025 06:12 AM
Hi @KrishnaMohan ,
Thanks for the Reply. It's working fine.
But one more thing i wanted to check
Is it possible to close this white window popup automatically after clicking on send like the same OOB email toggle(...dot>email) functionality works?
I tried with the .destroy method. It works as well.
but Actually first we need a way to know when the email has been sent and then calls GlideModal.get().destroy() to close the modal like that send button has been clicked then only it will be close automatically.
Can you please help me to do this.
Thanks and Regards
Ayushi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 04:59 AM
Hi @KrishnaMohan and all,
I got to know, there is a method which we can use directly in UI action to implement the same email functionality,