Views:

Scenario Overview

In this business scenario we need to generate an Outlook appointment (.ics) file as an attachment on an email when ever the 'Subject' field of the the email contains the word 'Doctor' & the regarding field is set to a record of type 'new_doctorvisit'.

The screenshot below shows the generated DoctorVisit.ics file attachment.

North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • A formula of type 'Save - Perform Action' is created & set to execute whenever an Email is created 
  • When an email gets created the formula first checks the subject line to see if it contains the word 'Doctor'
  • Next it checks to see if there is a regarding value set & that it is of type 'new_doctorvisit'
  • If all these are true then it will generate the ICS file
  • And finally it will attach it to the Email              

North52 Decision Suite Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type 'Save - Perform Action'
  • Set the Source Entity to Email
  • Set the Event to 'Create'
  • Copy & paste the formula below into the formula 
  • Click save & test

Formula

if( Contains([email.subject], 'Doctor')  and ContainsData([email.regardingobjectid]) and [email.regardingobjectidtype] = 'new_doctorvisit',  

          CreateNote('Doctor Visit',
                              'email',
                              [email.activityid],
                              'Doctor Visit',
                              'DoctorVisit.ics', 
                              'text/calendar',
                               Base64Encode(
                                      'BEGIN:VCALENDAR' + '\r\n' +
                                      'VERSION:2.0' + '\r\n' +
                                      'CALSCALE:GREGORIAN' + '\r\n' +
                                      'BEGIN:VEVENT' + '\r\n' +
                                      'DTSTART:' + ToString(FindValue('new_doctorvisit', 
                                                                      'new_doctorvisitid', 
                                                                      [email.regardingobjectid] ,
                                                                      'starttime', 
                                                                        '', 
                                                                        true),
                                                            'O' )  + '\r\n' +
                                      'DTEND:' + ToString(FindValue('new_doctorvisit', 
                                                                    'new_doctorvisitid',
                                                                    [email.regardingobjectid] , 
                                                                   'endtime', 
                                                                    '',
                                                                    true),
                                                           'O' )  + '\r\n' +
                                      'SUMMARY;ENCODING=QUOTED-PRINTABLE:' + 
                                       [email.subject]  + '\r\n' +
                                      'DESCRIPTION;ENCODING=QUOTED-PRINTABLE:' + 
                                       Left(StripHtml([email.description]), 200)  + '\r\n' +
                                      'LOCATION;ENCODING=QUOTED-PRINTABLE:New York (Office)' + '\r\n' +
                                      'UID:' + [email.activityid]  + '\r\n' +
                                      'PRIORITY:3' + '\r\n' +
                                      'END:VEVENT' + '\r\n' +
                                      'END:VCALENDAR'
                              )
                   ) ,

'NoOp' )

 

Did you know?

North52 has over 500 functions to help you implement advanced business rules and complex decision logic

One of the biggest costs on most Microsoft Dynamics 365/CRM project is custom coding. This is where consultants or developers are invloved in writing 100’s if not thousand’s of lines of code in Javascript and/or C#.

The Formula Manager, part of the North52 Decision Suite is a business rules engine that aims to eliminate this custom coding by using simple formulas instead. It is significantly faster (up to 10 times) than writing custom code and you get the added bonus of lower cost updates if a business rule changes in the future (it is much faster and thus cheaper to change it using a Formula rather than custom code).

There are over 500 functions available in the North52 Decision Suite business rules engine!

Learn more about North52 Business Process Activities