Category Archives: Company Update

Wedid: Custom Invoice Administration


This company earns their revenues through bookings services that they have planned and executed for their clients.

Their invoicing practice is to invoice all completed line items of the bookings in end of each month. For an example,  they would like to prepare the bookings and line items completed this month for invoicing.

Booking A
1) Account: Company XYZ
2) Booking Completed: 01/16/2015
3) Booking Line Items:
- Placement Booking
- Transportation Booking

Booking B
1) Account: Company ABC
2) Booking Completed: 22/16/2015
3) Booking Line Items:
- Placement Booking
- Transportation Booking

Booking C
1) Account: Company XYZ
2) Booking Completed: 01/16/2015
3) Booking Line Items:
- Placement Booking
- Transportation Booking

Booking C
1) Account: Company ABC
2) Booking Completed: 22/16/2015
3) Booking Line Items:
- Placement Booking


  1. The line items of each bookings are set as products in Salesforce. These products must be from a single pricebook.
  2. Build a Visualforce page that allows the record search and filtering. i.e. Dates.
  3. With the results found from the search and filtering, user can choose which bookings and their line items to be processed.
  4. Once proceed, a trigger will create opportunities for each bookings and booking line items will be created as opportunity line items against the created opportunities.
  5. User can then use an app to sync the opportunities and their opportunity line items over to their accounting  system for invoicing process.
Related Objects Product, Pricebook, Pricebook Entry, Booking, Booking line item, Opportunity, Opportunity Product
Components/App VisualForce, Trigger, Breadwinner App
Complexity Difficult

Boomi: SAP Integration Tips

This guide is not to help you to build a brilliant integration, but it gives you an important head start if you are integrating to SAP by using the Boomi SAP Connector.


  1. Before the installation, please make sure that you have installed the Java JDK (not JRE) in the server although Boomi Atom installer will download the Java JRE into the Atom installation directory (e.g, C:/Boomi Atomsphere/Atom – WDCi Atom/jre) if you do not have one in the server. Unfortunately, the Java JRE is not sufficient to run the SAP connector.
  2. You need to create a JAVA_HOME environment variable to point to the Java JDK directory and also include the JAVA_HOME/bin into the global path environment variable.
  3. After the installation, you will need to download the additional SAP library from the official site ( > SAP Java Connector > Tools & Services) and extract the content into the <Boomi atom installation folder>/userlib/sapjco folder (e.g, C:/Boomi Atomsphere/Atom – WDCi Atom/userlib/sapjco).
  4. Once the above is done, please restart the Atom service in order for the changes to take effect.

Notes: If you would like to use SAP IDoc Listener (for real time integration), Boomi SAP connector requires a database (for tracking purpose) and you will need to download the required JDBC driver and place in the userlib/ folder.

Operation Profile

After importing the operation, please make sure that the date data type field has the correct date format in both Request and Response profile. The format used by the connector is:

  • Date = yyyy-MM-dd
  • Time = HH:mm:ss

Failing to configure the date in the Request profile would cause the connector to always returns all data from SAP.

Get Operation

Mostly, you will query the data by using last updated date time. The date/time format for the query operation is:

  • Date = yyyy-MM-dd (this is different from the format being used in SAP BAPI Tester, dd.MM.yyyy)
  • Time = HH:mm:ss

Send Operation

If you are sending information to SAP via a BAPI operation, it is best to double check with the SAP developer to see if they require Boomi SAP Connector to send “Commit Transaction” as part of the BAPI call. If yes, please make sure that the “Commit Transaction” option is checked in the SAP operation.

Salesforce Duplicate Management

Duplicate Management Overview:

Duplicate Management is a new Salesforce feature that helps you to maintain cleaner data by preventing Salesforce users from creating duplicated data. See Salesforce overview documentation.

Objects available for this feature:

  • Account
  • Contact
  • Lead
  • Custom Object

Key component of search logic:

  • Duplicate Rules – Define when a duplicate record can be save / created.
  • Matching Rules – Define what can be used to identify a duplicate record. ie: Email field.
  • Duplicate Record Sets – A list of duplicated records saved in a new Salesforce Object. This will work only if you have checked the ‘Report’ checkbox in defining the Duplicate Rules.
  • Duplicate Error Logs – This is to track any error during record matching.

For more information, see this documentation.


If you ever wonder why the duplicate error did not kick in when you have made changes to a duplicated record, the reason is probably because the changes made are not against the field(s) that is used in the duplicate check rule.

To test it out, you can try below:

  1. Created 2x lead records with the same email address
    • Lead 1 –
    • Lead 2-
  2. Create a duplicate matching rule (e.g, exact match) that listen on email address field in Lead object
  3. Enabled the rule on create and edit action

Result on Create:
Salesforce will display an error when a new lead created with email =

Result on Edit:
Salesforce will skip the duplicate check when the existing Lead 1 was updated WITHOUT changing the email field information (which is currently duplicates of Lead 2). Error willonly prompt if a Lead email is changed from to

To know more about this feature, please see

Salesforce: Shortcut to populate picklist value

Imagine that you need to import some data into a picklist field name ‘Relationship’ and you will need to create this field beforehand. There are about 100 picklist values available for this field. For example:


  • Picklist value 1
  • Picklist value 2
  • ….
  • ….
  • Picklist value 100

Question: What are the options that can help speed up the creation of this picklist field?

Manual way:

1) Use excel to remove duplicated picklist values and list out only the unique ones.

2) Use unique values to create picklist.

Manual way above should work pretty well. However, there is also an alternative workaround.


1) Create a text field called ‘Relationship’ in SF.

2) Migrate all the data as usual (Note: map the data to the ‘ Relationship__c’ custom text field in SF).

3) Once migration is completed, change the ‘Relationship__c’ field type from Text to Picklist.

During the change in step 3, Salesforce will automatically list out all the values from the migrated records. It is also smart enough to differentiate duplicated values.


  • Save time populating values manually
  • Prevent human error.
  • Duplicated ‘Picklist value 1′ will be listed only once.


  • Value: ‘Picklist value 1′ and ‘Picklist value1′ is treated as different value.

Salesforce: Validation Rule to Control Number Field

Scenario: To make sure that users do not key in any alphabet values to a field.

Problem: In some situation, you will need to choose text field type for your number field. For example, Contact_Id__c should be a number field. But if you choose the field type as Number, you will end up having result of ’100,569,333′ as your Id.

Solution: To overcome this, you can choose to use text field type. However, you will need some validation to avoid users from adding in alphabet value. For example:

Contact Validation RUle


Enforcing Number Format In Text Field

Sample scenario: Each Contact will be tied with an external Id that is made out of a set of numbers. To keep track of these numbers, you need to create a custom field with either text or number as field type.

Problem: If you choose to use number as field type, your external Id will end up like this – 1,234,567. But if you choose text as field type, you might have bad data because it allows alphabet characters. 

Workaround: To overcome this, you can choose to use text field type. However, you will need some validation to avoid users from adding in alphabet value. For example:

Contact Validation RUle

Salesforce: Broadcasting Newsletter to Community Users

There are many different options available in broadcasting newsletter to community users, such as using native Salesforce feature of send email or third party apps from the Appexchange if you have more specific requirements or simply using other applications for marketing purpose.

We have recently implemented this requirement with a combined utilisation of:

  • Mail Chimp as the marketing tool
  • third party app Chimp Sync from the Appexchange to sync to Salesforce

This implementation has achieved the following requirement:

  • subscription list can be made available in Salesforce
  • community users can be added to the subscription list for broadcast in Mail Chimp
  • community users are able to receive newsletters via email and directly access it
  • past and present newsletters will be available in Salesforce

Salesforce Visualforce Page View State

Have you ever encountered the “Maximum view state size limit” error on the Visualforce page that you developed even though you only capture very little information (e.g, like 3 input fields)?

Maximum view state size limit (135KB) exceeded. Actual view state size for this page was xxx.xxKB

The way that the view state works is that it is not only holding the value of the field that you capture on the page, but it also holds the value of any accessible objects/variables that you have declared in the controller/extension. For example, if you have an object list (e.g, List<Account>) and the list is holding a lot of records, you might encounter the view state size limit error even though you are not displaying result in the page.

Salesforce has a good explanation on Visualforce View State that gives you a good start if you are troubleshooting the issue. As a good developer, you should also follow the best practice guide to develop a performance optimized Visualforce page.

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 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.