Hi
I would like to send an appointment to a contact. When I create an appointment I click save and "send link by email"
after I click the "send..." it open me the email app.
I would like to use it in a different way which mean I don;t want the crm will open the email app, just send the appointment to the customer and to the owner
can I do it?
Thanks, Ilan
Hi ilan,
You could download my unmanaged solution for quick test:
https://send.firefox.com/download/3bb40b7007d76626/#rAdGxuzKnVDhEpb8qFHDnw
(pw: enjoycrm08433)
make sure following fields are populated and your current user has a valid & enabled mailbox,
(also contact's mailbox should be valid)
then click Send Email button.
You'll receive a dialog if success.
Please kindly mark as verified if you had found my answer helped, it would be greatly appreciated.
Regards,
Clofly
Thank you very much for your answer
I will try it
Hi ilan,
1. We could only send an email in Email form, or it could be said that Send button is only available when we creating a new email.
2. As what you have mentioned, "send link by email" will just wake up default email application in desktop.
So my answer in my first response would be your option:
you could easily create an email by Web API which contains any fields data you want from an appointment,
upon the email has been created successfully, CRM will return us a guid of the new record, next call SendEmail Web API action to send it by using the guid.
We just need to create a new custom ribbon button by Ribbon Workbench tool, then bind our custom javascript function to that button.
In conclusion, customization code is required to achieve your requirement,
after you've added a custom button to command bar(ribbon) successfully, then just copy my code to jscript web resource and bind it to the button.
I'll always reply if you:
-> had question when using Ribbon Workbench.
-> had requirement on which fields should be included in email(change code)
-> had requirement on format of email content.(description)
If you had thought that my answer would meet your requirement.
Regards,
Clofly
ok you have a point. I would like to create an appointment. to send the meeting to the contact there is 2 way.
1. click save and it will send an email
2. click on "send link by email"
it all depend on the settings
I would like to have third option
add a button says "send". it because I would like to add more details and send it automatically without using the outlook (like the first option)
is it possible?
Hi ilan,
My code is used to create an email activity record based on an appointment record.
If you had enabled Server-Side Synchronization to Appointments, Contacts and Tasks for your mailbox,
(you need to Test & Enable it again to update configuration)
then if you create an new appointment record,
CRM will automatically send an email with an ics file which contains the appointment information to contact mailbox.
You can find the sent item in both your CRM mailbox
and in contact's mailbox.
(Note: my CRM timezone, Outlook timezone and Gmail timezone are all different, the schedule time is based on mailbox setting)
In conclusion, you can schedule a meeting through CRM and it will sync to contact's mailbox automatically.(Up to 5 minutes)
At beginning, I thought you would just like to create an email based on an appointment and sent it to related contact of appointment.
So you won't need code to achieve your requirement, it could be said that the code is just to send an extra notification to contact.
Regards,
Clofly
Well, no, I said the opposite.
If, however, you are using Outlook and CE, you should load the Outlook client. Then the two of them are fully integrated. In fact they can do everything FROM Outlook.
My point was that sending a link for a CE record is not in any way like sending an invitation. And, in fact, you've already sent the invitation by "sending" the appointment -- assuming you've set up a mailbox for the user.
Think of it this way. CE is just as bad at communication as Outlook when neither have Exchange/email service. But with it they are the same.
So, if i understand you, there is not way out of the box to schedule a meeting through CRM and sync it to the contact's outlook?
Hi ilan,
Screenshot 1 is not completed for my demo appointment record,
here is a full screenshot:
Start Time and End time are always dynamic, which are fetched by Xrm.Page.getAttribute("scheduledstart").getValue() and Xrm.Page.getAttribute("scheduledend").getValue(),
(the date timezone is based on your local time, it will change if your timezone is in other regions, so China standard time will only display in my environment test)
if you had rescheduled an appointment, then send a new email again, all information will be updated in the new email.
Please point out whether I didn't understand your schedule and reschedule concepts correctly.
Regards,
Clofly
the problem is it looks like you sending an email and not schedule an appointment. and what if I reschedule to another date? will it send an update?
Hi ilan,
You could do it with javascript, the whole process is:
1. Create a custom button and add it to ribbon with Ribbon Workbench, then bind custom javascript(2 & 3) command to the button.
2. Create an email record based on an appointment record by Web API.
3. Send new created email with Web API action: Microsoft.Dynamics.CRM.SendEmail
Here is a tutorial about step 1, there are also many other tutorials about the topic.
https://dynamicscrmtips.com/button-dynamics-crm-ribbon-workbench/
I've tested following code which has integrated step 2 & 3 and it works well, you can create a HTML web resource for quick test:
createNow(); function createNow() { var fromUser = Xrm.Page.context.getUserId().replace(/[{}]/g, ""); var toPerson = Xrm.Page.getAttribute("requiredattendees").getValue()[0].id.replace(/[{}]/g, ""); var subjectText = "Your appointment is coming"; var descriptionText = ""; descriptionText = "Subject: " Xrm.Page.getAttribute("subject").getValue() "
"; descriptionText = "Start Time: " Xrm.Page.getAttribute("scheduledstart").getValue() "
"; descriptionText = "End Time: " Xrm.Page.getAttribute("scheduledend").getValue() "
"; var entity = { "subject": subjectText, "description": descriptionText, "regardingobjectid_contact@odata.bind": "/contacts(" toPerson ")", "email_activity_parties": [ { "partyid_systemuser@odata.bind": "/systemusers(" fromUser ")", "participationtypemask": 1 }, { "partyid_contact@odata.bind": "/contacts(" toPerson ")", "participationtypemask": 2 } ] } var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() "/api/data/v9.0/emails", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 204) { var uri = this.getResponseHeader("OData-EntityId"); var regExp = /\(([^)] )\)/; var matches = regExp.exec(uri); var newEntityId = matches[1]; SendEmail(newEntityId); } else { Xrm.Utility.alertDialog(this.responseText); } } }; req.send(JSON.stringify(entity)); } function SendEmail(emailGblId) { var parameters = {}; parameters.IssueSend = true; var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() "/api/data/v9.0/emails(" emailGblId ")/Microsoft.Dynamics.CRM.SendEmail", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var results = JSON.parse(this.response); var confirmStrings = { text: "Email has been sent. \n Would you like to open it immediately?", title: "Confirmation" }; var confirmOptions = { height: 150, width: 250 }; Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then( function (success) { if (success.confirmed) { openEntityForm(emailGblId, "email"); console.log("Dialog closed using OK button."); } else { console.log("Dialog closed using Cancel button or X."); } }); } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(JSON.stringify(parameters)); } function openEntityForm(id, entityName) { var entityFormOptions = {}; entityFormOptions["entityName"] = entityName; entityFormOptions["entityId"] = id; // Open the form. Xrm.Navigation.openForm(entityFormOptions).then( function (success) { console.log(success); }, function (error) { console.log(error); }); }
Result 1: User will receive a confirmation dialog about the email has been sent successfully,
if he clicks Ok, then he'll be navigated to new email record.
Result 2: The delivered test email
My code is very basic, you could extend it with more necessary features,
such as validation for fields, add more information from appointment record into description,
better format for schedule time and email content etc.
Regards,
Clofly
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Eugen Podkorytov
106
Muhammad Shahzad Sh...
106
Most Valuable Professional