Tag Archives: salesforce apex

Wedid: Salesforce Skedulo Case Integration


This companies main revenue source is derived from the repair services and additional products they provide to the commercial and residential business.

The technicians are required to repair items, keep track of replacement products issued to the customers, collect signatures, take images of the issues found, advise the next technician to onsite of the job requirements and what they foresee the next technician will be required to complete.

The challenge for this solution was that there would be up to 3 job visits, each job visit containing data that would need to be passed from one technician to another, without any phone or email communication.


In the case, we used Apex trigger in conjunction with Skedulo and a custom Visualforce page to send the user to the Skedulo Web Browser for scheduling.

We used standard and custom fields created in Salesforce and Skedulo to capture some of the following data:

  • Products used
  • WHS issues identified or not
  • Signature Collected
  • Marketing Questions answered
  • Contact Details checked and updated
  • Images of site collected
  • Any expenses

There was a two-way sync with different trigger points between Skedulo and Salesforce allowing the data to flow back and forth.

Integrating the case with Skedulo enabled the client to automate communication between their field technicians and administration staff, reduce the paperwork created from each job, have a live status update running on each job/case for an enriched customer service and communication experience.

Related Objects Case, Skedulo Job, Product, Pricebook, Pricebook Entry
Components VisualForce, Trigger
Complexity Medium

Salesforce: Problem Deleting Batchable Apex Class

Recently, I encountered a weird error when trying to delete a batchable Apex class from Salesforce instance. The error was:

This apex class is referenced elsewhere in salesforce.com. Remove the usage and try again.


The reference was pointing to an Apex Job. Initially, this was a bit weird as I had checked that the Apex Job status was shown as Completed before deleting the Apex class. After doing some study, I found that this is related to one of the “error” Apex Job but with status Completed. To be specific, the Apex Job died at the execute() method due to stupid code that I have written and it never reach the finish() method to close the Apex Job execution properly. The Apex Job is still considered open at the backend even though the status is Completed.

If you encounter the similar issue, you can perform the following:

  1. launch Developer Console
  2. open Execute Anonymous Windows
  3. paste the code: System.abortJob(”);
  4. click Execute to run the script

This should kill off the job and you can proceed to delete the Apex class now.

Wedid:Warranty Service Management using Case


An machinery company sells products to their users directly or via a dealer. When the product has an issue, they will ring up the machinery company. The serial number checking process is manual and not efficient. When a technician is sent on site, a work order/invoice require signature immediately. This is not possible at this moment.


Salesforce case module is customised to relate assets (serial number). From the asset warranty date, they can decide if this repair service should be covered under the warranty. During the site visit, the technician will bring a tablet and generate the work order/invoice on the spot. The customer can sign the work order/invoice on the spot using electronic signature.

Related Objects Asset, Case
Components SDoc, DocuSign, Apex Trigger
Complexity High

Wedid:Asset Rental Automation


An Art Investment company build portfolio for their investors and rent it out on behalf of them. In order to build the portfolio, different art pieces will be included. The cost/margin of each art piece needs to be calculated. The rental price of each art piece will require calculation too. All calculations are done manually. From time to time, the company loses track of the art piece actual physical location.


Customise Salesforce to handle:

  • Art piece sales
  • Portfolio investment build
  • Art piece rental
  • Agreement Generation
  • Auto calculation for sales/rental price
Related Objects Account, Opportunity, Products, Custom Objects
Components SDocs (Third-party app), Apex Trigger and Data Model Design
Complexity High

Wedid: Automated Record Link


Certain products that are up for sale require product activation code. In Salesforce, a custom object is created to store all the product activation code records. Whenever an opportunity is closed won, the opportunity products should be assigned with activation codes and details. This can then be generated out in PDF form and sent to customers. There are a series of filters and criteria involved when it comes to assigning the right activation codes to the right opportunity products and this process is currently being handled manually. User will have to eyeball both the opportunity products and activation codes to link them appropriately. It is pretty time consuming when you have to manually assign these activation codes to the opportunity products when the list is long (e.g. 10 products and above).


We have implemented Visualforce page and Apex classes and to do the following:

1. Page to list out all the opportunity products that require product activation codes (exclude the product that do not require activation codes).

2. Apex class to search for available product activation codes from a different object based on specific criteria.

3. Apex class to link both the opportunity product and the product activation code together and populate relevant product activation code data to product and vice versa.

Related Objects Custom Objects
Components Apex Classes, Visualforce Page
Complexity Medium

Wedid:Salesforce Create Monthly Opportunity Automatically on Subscription Duration


The company sells product base on monthly subscription. There is a challenge for them to forecast their monthly revenue base on Account Industry.

At this moment, Salesforce only supports forecast by users or by products. In order for the forecast to work accordingly (by Account Industry), user has to manually create a series of opportunities base on the contract term of subscriptions


Custom Trigger on Opportunity object. This trigger will relate the opportunity to the respective budget and, at the same time, automatically creates a series of related opportunities based on the contract term of subscriptions.

For example, If the term is for 2 years, 24 related opportunities will be created. Users are able to see the forecast revenue over a report which lists out all the related opportunities by month.

Related Objects Opportunity
Components Apex class
Apex trigger
Complexity Low

Wedid: Salesforce Community Customisation


Customer would like to host a community forum in Salesforce which allows customers to discuss and contribute ideas by using Salesforce Chatter function. They also would like to consolidate the information that they have in the website to the community forum.


The Salesforce Visualforce page is used to build a custom webpage for the community forum. The Visualforce page also embed with the Chatter functionality so that customers can collaborate with each other.

Related Objects Account
Custom Object
Chatter Topic
Components Visualforce Page
Apex Class
Salesforce Community
Complexity High

Wedid: Custom workflow in Salesforce


Customer is a professional property buyers group in Australia. They help their clients to analyse, purchase and manage the properties. As the whole process is tedious and hard to manage (e.g, information gathering, activity tracking, customer meetings and etc), they would like to implement a clean and lean workflow wizard in Salesforce that can help to reduce the manual work.


A custom object is created to act as the workflow stage. In each stage, there will be a list of fields that need to be tracked. A series of Visualforce pages are used to read the workflow stages from the custom object and render the required fields dynamically on the fly. The Visualforce pages are also act as the wizard to guide the users through the necessary steps involved in the business flow.

We also use Salesforce Cloud Scheduler and Activity object. This allows users to schedule their meeting with customers and track any other activities.

Related Objects Account
Property (Custom Object)
Settlements (Custom Object)
Loan (Custom Object)
Components Visualforce Page
Apex Class
Workflow Rules
Cloud Scheduler
Complexity High

Wedid:Salesforce Custom Clone Button


An insurance company requires the renewal customer policy yearly. The out-of-box clone button is not sufficient as the policy dollar value will need to be recalculated and certain date fields are change during the cloning process. Also, it will not copy all the child records.


Custom clone button with Apex Extension

Related Objects Policy(Custom Object)
Components Apex class
Custom button
Complexity Low

Wedid:Salesforce Auto Renewal Email Services


This company sells maintenance contract to their customers. Each contract has a maintenance due date. A couple of emails are required to be sent out before and after the maintenance due date, for example, 10 days before the due date and 5 days after the due date. The standard workflow function has limitation building a dynamic template driven from different custom object.


Built an scheduled Apex Job that runs daily. This job calculates contract maintenance fees automatically.

Related Objects Contact
Email Template
Components Schedulable Apex class
CronTrigger Job
Complexity Medium