Skip to main content

Notifications

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

  • Verified answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at
    RE: Mailto custom ribbon button not working when body is over 2000 characters

    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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans