web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Mailto custom ribbon button not working when body is over 2000 characters

(0) ShareShare
ReportReport
Posted on by 215

Hi guys,

I have problem with a custom ribbon button that we created, the button has similar functionality as the "Email a link" button, except it captures required information from an appointment and opens up the users mail client with a longer body than the "Email a link button".

Now the issue here is that usually the body is longer than 2000 characters and when it is so the button does not open the default mail client, simply nothing happens. Is there a workaround for this? How can we achieve the same functionality for longer URL's? Here's a code sample of the current function that executes when clicking the button:

function MailTo() {
    debugger;
    var entityId = Xrm.Page.data.entity.getId();
    var regarding = Xrm.Page.getAttribute("regardingobjectid").getValue();
    var reqAttendees = Xrm.Page.getAttribute("requiredattendees").getValue();
    var optionalAttendees = Xrm.Page.getAttribute("new_otherattendees").getValue();
    var description = Xrm.Page.getAttribute("description").getValue();
    var reqActions = Xrm.Page.getAttribute("sonade_requiredactions").getValue();
    var subject = Xrm.Page.getAttribute("subject").getValue();
    var location = Xrm.Page.getAttribute("location").getValue();
    var startTime = Xrm.Page.getAttribute("scheduledstart").getValue();
    var endTime = Xrm.Page.getAttribute("scheduledend").getValue();
    var durration = Xrm.Page.getAttribute("scheduleddurationminutes").getValue();

    var value = "Regarding Account: " + regarding[0].name + "\r\n"
        + "Required Attendees: " + reqAttendees[0].name + "\r\n"
        + "Optional Attendees: " + optionalAttendees + "\r\n"
        + "Description: " + description + "\r\n"
        + "Required Actions: " + reqActions + "\r\n"
        + "Subject: " + subject + "\r\n"
        + "Location: " + location + "\r\n"
        + "Start Time: " + startTime + "\r\n "
        + "End Time: " + endTime + " \r\n"
        + "Durration: " + durration;
    //value = value.replace("\n", "\\u0A");
    //var url = Xrm.Page.context.getClientUrl() + "/main.aspx?etn=appointment&extraqs=formid=549A8AA3-C349-4AB9-8BAC-4873FA9A7A5C&id=" + entityId + "&pagetype=entityrecord";
    //url = url.replace('{', '').replace('}', '');
    //var uri = encodeURIComponent(url);
    value = encodeURIComponent(value);
    var body = encodeURIComponent("body=");
    window.location.href = "mailto:?" + body + value;

Thanks in advance, Filip.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    I guess this is the limitation of url querystring & we have to customize/play around within the limits.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans