Blog abonnieren
Kontakt
feature image

Projecting Custom Objects in Salesforce Calendar

We bring to you the first real-life example of how Process Builder can make any Salesforce.com Professional excel her/his job when minimizing the amount of APEX code when implementing custom setup for the Salesforce.com platform.

This is also our ambition hereat Cloud Consulting Group: to maximally utilize the standard Salesforce.com Out-Of-The-Box solutions and Point-And-Click Development to decrease the projects costs, minimize the maintenance expenses and deliver more the most business software features within the same budget.

Recently, one of our customers came with a typical request for a custom object being shown in the calendar. Additionally, the customer’s internal security policies allowed no additional AppExchange add-ons and it was also favorable to avoid the deployment of a complicated APEX logic.

As a lightning from the clear sky, the Cloud Flow Builder and Process Builder, both branded as core features of “new” Salesforce Lightning development package, have proven their power when the customer’s calendar requirement got delivered in a record time with minimum (almost none) code.

This blog article is going to present to you one of the possible solutions for projecting any custom object’s records within the Standard Salesforce Calendar using Lightning Processes. Naturally, the custom object must contain all necessary fields the user would be normally prompted to populate when creating a standard Activity Record (Start Date, Duration, etc…). There also must be a business reason to project these custom records in the calendar. Our customer’s case was straightforward:

  • German Salesforce.com customer uses custom activity object called “Kundenaktivitäten” (standard Activities were evaluated as not suitable the intricate internal business procedures). Besides other key information, this custom object’s records store Start time, End Time, Duration and Details related to the relevant customer activity.

What is also essential to have in hand for our processes to work properly is a Unique Identifier of the custom object’s records – in our case it is the Auto-Numbered Name for all “Kundenaktivitäten. This Identifier is going to make the setup of the projection of custom records in the Standard Calendar very easy.

In a nutshell, we are going to create two simple Flows, which manage the creation, updating and deleting of the “reflections” of the “Kundenaktivitäten” records in the standard calendar in a form of Event records. No worries, the setup can be quickly fine-tuned into such a level, when the end-user never notices the existence of these affiliated Event records and the experience is then flawless.

Back to our real-life user case: We derived a list of 4 critical calendar features our solution was supposed to deliver.

Calendar functions:

  1. When a new custom record (“Kundenaktivität”) is created, it must be projected in the user’s calendar.
  2. When an already existing custom record (“Kundenaktivität”) is edited, the related calendar record must get updated as well.
  3. When the custom record is deleted, it must disappear also from the calendar.
  4. (Optional) When the calendar event is opened from the calendar view, the custom record is shown directly instead of the standard Event record itself.

Isn’t it exciting, that you can cover first three requirements solely by the utilization of Process Builder and Flow? The last function calls for a few lines of Visual Force, but you will see later, that anybody can write it.

Let’s use the power of Lightning to deliver some great features for no additional costs.

Author’s note: We anticipate that you are at least basic awareness of Lightning Process Builder and Flow’s usage and setup. There is no rocket science used in this tutorial, therefore we encourage even complete Salesforce Greenhorns to give it a try. Do not be afraid of failing the first time!

Functions 1 & 2:
To fulfill first two requirements 1 & 2 from our brief master list of customer requirements, one simple Process Builder triggering one not-more-complicated Flow must get placed.

PROCESS BUILDER
Screenshot Process Builder

  1. Custom objectKundenaktivitäten” selected with the start element with an attribute when a record is created or edited - we want to initiate this process for both new and existing “Kundenaktivitäten” records
  2. (Optional) You can add some business logic into the Decision Nod, which decides what kind of “Kundenaktivitäten” trigger the immediate Flow action in the later step. For example, we are filtering only “Kundenaktivitäten” related to the Accounts with Austrian billing address.
  3. Simple Auto-launched FlowEreignisse im Kalender erstellen und aktualisieren” checks whether the calendar event must be created (when new “Kundenaktivität” gets created) or an existing calendar event must get edited (when an existing “Kundenaktivität” gets edited).

FLOW
Short note before we describe the Flow: As already mentioned in the beginning of this article - To make the creation, updating and deleting of calendar events straightforward, map one of the calendar events fields with an unique identifier – in our case it was the auto-numberedKundenaktivitätenname attribute. Therefore, we are always sure that we are triggering actions only for relevant calendar events.

Flow

  1. In the very first step, the Flow looks for already existing calendar standard events related to the “Kundenaktivität” from which the Flow has been triggered. As you may anticipate, we use “Kundenaktivität” ID as the variable.
  2. No such an calendar event found? Then the “Kundenaktivität” must be new and we must to quickly create the calendar event for the user!
  3. The flow collects all the important information (including all mandatory fields for the creation of a calendar event) from the “Kundenaktivität” when looking it up using our known record ID.
  4. Using all the information collected in the previous step, a brand new calendar event gets created!
  5. If the Decision Filter in Step No.2 actually finds one calendar event that is related via lookup to the “Kundenaktivität” that triggered this Flow; as you may guess; it means that this “Kundenaktivität” and its calendar event entry are already existing. Then, somebody must have edited this “Kundenaktivität” and we need to update the relevant calendar activity!
  6. Similar to Step 3, the flow collects all important information from the “Kundenaktivität”.
  7. Last but not the least, we update the related existing calendar event with the fresh data collected in the previous step!

 Author’s note: Just for your illustration, our Flow collects only these fields in steps 3&6: StartDateTime, EndDateTime, Subject, Description, Owner, RecordTypeId.

Function 3:
Good job so far! We have just delivered the customer requirements 1, 2 and we can start working on the requirement 3, which is also easy to deliver with the power of the Flow.

Since the Flows can also delete records, we build a Detail-Page Custom Button calling the URL of an Auto-launched Flow that firstly deletes the Calendar Event Record (using the unique attribute mentioned earlier) and then deletes also the custom recordKundenaktivität” on which the button was clicked. In our case the button body looks like this:

Screenshot Button Body

Author’s note: The snapshot of this trivial Auto-launched Flow from this step is not published in order to make this blog brief. Let us know if you miss it!

The last step is to put the Custom Button on the Page Layout for correct record types according to your business requirements.

Function 4:
As a cherry on the top of the cake, the last Optional Customer Requirement (4) makes the user experience truly flawless: When clicking on the calendar event created as the custom object “Kundenaktivitäten” record’s calendar representation, it is desirable to be redirected directly to the custom record!

Here we use a standard View Button Override using a simple Visual Force page.

Tip: In order to distinguish the calendar Event records created automatically with our Processes from standard Events created manually by users, we dedicate one Event Record Type for all Events created in order to represent the “Kundenaktivitäten” records in the Calendar. Do not forget to modify our already existing Auto-Launched Flow used earlier in the blog, so it creates only Event records of this specific record type!

Having this new event record type; a simple detail view Button Visualforce Override (can be setup under Event Buttons and Links) will automatically decide what to show to the user when clicking on the Calendar Event – custom “Kundenaktivitäten” record or standard manually created Event.

In our case the Visualforce page used as the button override looks like this:


<apex:page standardController="Event"
   action="{!IF('Kundenaktivit_ten_Im_Kalender'==Event.RecordType.DeveloperName, URLFOR('/' + Event.Kundenktivit_t__c), URLFOR('/' + Event.Id + '?nooverride=1') ) }">
</apex:page>

Voilà, Done! A round of applause for all the readers who came all the way here! We realize that it was a long article, but just look at the amount of fucntionality you have just delivered!

As a recap, a simple user case will show what we have accomplished:

USE CASE:
1. User creates new custom object record with some sort of scheduling information that he/she also wants to see in the calendar.

Screenshot Create new custom object

2. After launching the Calendar view, the user can see a Calendar Event in his/her Calendar.

Screenshot Calender with Calendar Event

3. When clicking on this standard calendar event, the user is redirected to the correct “Kundenaktivitäten” custom record and the user can easily rwead and update it.

4. Let’s, for example, edit the Start Date of the “Kundenaktivitäten” record!

Screenshot Edit Start Date

5. After saving, the calendar event is updated accordingly. User can check it in the user’s calendar:

Screenshot updated Event

6. And the last point of our agenda – what happens with the calendar view once the original “Kundenaktivitäten” custom record gets deleted? As you remember; our Custom Button calling the Auto-Launched Flow deletes both the “Kundenaktivitäten” record and its related calendar event!

Screenshot klick on delete
Screenshot Event successfully deleted

You have just created a solution for projecting custom records in calendar and saved significant funds you would normally spend on custom app or a complex APEX development! Stay tuned for next article being published in 14 days!

 

For questions and feedback please fell free to contact us!

Contact

  • Share this offer:

Haben wir Ihr Interesse geweckt?

Wollen Sie mehr zum Thema Inbound Marketing wissen, oder anderen Themen rund um Marketing Automation oder HubSpot-Produkten? Unsere Berater helfen Ihnen gern weiter! Kontaktieren Sie uns einfach telefonisch unter 0800 181 4054.
Wir freuen uns über Ihre Nachricht.

Infos anfordern
SIE HABEN FRAGEN?
MELDEN SIE SICH!

Telefon:+49 69 9675 86 29
E-Mail: info@cloudconsulting24.com

CLOUD CONSULTING GROUP GMBH

OFFICE FRANKFURT (Zentrale)
Barckhausstraße 2 
60325 Frankfurt

+49 69 9675 86 29
info@cloudconsulting24.com