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 guess this is the limitation of url querystring & we have to customize/play around within the limits.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
52
Victor Onyebuchi
6