Category Archives: Salesforce Corner

New RIO Inventory 3.7

Introducing the New RIO Inventory 3.7 release to the Appexchange. This update has new features that include:

  • SKU can now be used as the Product Unique Identifier
  • Changing the RIO Inventory Configuration’s Product Unique Identifier field now also runs a batch update of all Product’s Inventory Product Code+
  • The Opportunity Assignment Overview page recognises if there are Opportunity Products with 0 assignments
  • Inventory Adjustment page has improved compatibility with older Apple devices
  • Custom Lightning lookup fields now handle special characters correctly
  • Application in the App List has been renamed from “RIO Readymade Inventory+” to “RIO Inventory”
  • The included “RIO Inventory Permission” permission set has been updated

Check out this Page for more details on RIO Inventory and the documentation site. Install the app if you are new to RIO Inventory and enjoy our new release.

Have some new feature ideas that you think will benefit RIO Inventory? Please tell us your suggestions at support@wdcigroup.net

Wedid: Enhanced Recurring Event in Salesforce

Challenges

The customer manages their clientele function bookings (i.e. company meeting, birthday party, wedding dinner, etc.) within Salesforce via a custom event app and integrated with a calendar app to display each of the events in the calendar view. Requests from their clientele for recurring functions/events such as weekly board meeting, community discussion and many more need to be tracked accordingly within Salesforce, plus being displayed on the calendar app view accordingly. Double booking on the slot which may have been booked by other occasions is not allow and needs to be notified.

 

Solution:

The parent event was created via the custom event app. The customer utilised the standard Salesforce task object (which allows defining recurring activities) attached to the parent event.  This  is used to spawn the desired recurring event (Children records to the parent event) when the events are created. They are to be displayed accordingly in the calendar app view as well. Additional apex customisation is used to handle the double booking scenario instead.
Sample flow

Related Objects Account, Tasks/Activities and other related Custom Objects
Components Custom Button, Visualforce Pages, Apex Classes
Complexity Moderate

Salesforce: Replacing Custom Button with Formula Field

Ever wonder how you could use the formula field as an alternative to your custom button?

This can be achieved by utilising the HYPERLINK() and the IMAGE() functions as well as an image to represent the button. You could possibly settle with just a text link rather than button as well.

For example: HYPERLINK(${Construct_the_link_here},IMAGE(${the_path_to_the_button_image},”a_description_for_the_image”),${the_link_target_behavior-optional})

As a result, you could:

  • Define the field level security (considering it is a field) if you have specific requirement over who can or who can’t execute the button
  • Make the button appear in the view list and therefore, the user could use the button even without needing to drill all the way to the record

sample

New RIO Inventory 3.5

We are pleased to announce our newest release of RIO Inventory version 3.5 to the Appexchange. Our new features include:

  • Lightning Styled Pages (Compatible with Lightning Experience and Salesforce1).
  • The Opportunity Tracking Number field now fits 18 characters
  • Assignment Page Lines are now sorted by Batch and Serial Numbers.

Check out this Page  for more details on RIO Inventory and our new documentation site. If you are new to RIO Inventory you can always install the app  and experience the new lightning styled pages.

Want new features that you think will benefit RIO Inventory? Please tell us your suggestions at support@wdcigroup.net.

Wedid: Using Salesforce in a Residential Care Environment

Challenges

The main business requirement for the aged care facility was streamlining all the information to a single point of data entry as well as providing transparent updates to the residents.  Optimal care of the resident is enhanced when all data is stored in a single system.

Data such as medical records, progressive monitoring and the sharing of social updates as well as picture sharing among family members accessible via mobile.

Ability to grow as the facility increased the number of residents. The ability to provide a secure data store with access restricted based on users and information type.

Solution:

  1. Gather all data and understand the origin and process involved
  2. Design the data model and to ensure a single point of data but ensure that security will not be compromised
  3. Leverage Salesforce Customer Community to provide updates on the residents to family members

Related Objects Lead, Account (Person), Contact, Other Custom Objects
Components Data modelling, Customer Community, Visualforce Page, Apex Trigger
Complexity Medium

Salesforce: Check Null/Empty Value of A Field

In Salesforce, it is very common that we build formula field, validation rule or workflow rules to act on the data of a field and sometimes we would like to validate on an empty value. In Salesforce formula editor, there are two functions: ISBLANK() and ISNULL(). The question here is, which is the correct one that we should use?

ISNULL()

This is an old function that works with most of the field types except Text, Text Area and Long Text. (reference)

ISBLANK()

This is a new function that Salesforce introduce to support the empty field validation on Text fields. It also works with other field types. According to Salesforce documentation, it is recommended to use this function instead. (reference)

Please note that if you are referencing a formula field with the option “Treat blank fields as zeroes”, the formula field will give value zero and won’t be considered as null.

Above is how you can validate an empty field in formula editor. How can we achieve the same in Apex?

Text Fields

There are a few options to validate empty text fields in Apex:

Use String.isBlank() method. This will return true if the text field is empty.
Compare the text field to an empty string, e.g, Account.Name == ”. You shouldn’t use NULL as text field in Salesforce is never considered NULL. Note that String variable can still be considered NULL.

Checkbox Fields

This can be compared by using TRUE or FALSE. This is because an unchecked checkbox field is considered as FALSE instead of NULL.

Other Fields

You should compare the field value to a NULL.

Salesforce: Visualforce CommandButton to Bypass Validation/Required Fields

In Visualforce apex:CommandButton component, there is an attribute called “immediate” that allows us to invoke the controller action bypassing the validation rules associated with the fields (especially those that mark with required=”true”) in a visualforce page. I have been using this attribute alongside with the cancel button which does not required any input from users. Until recently, I noticed that the attribute no longer working as expected in one of my visualforce page development. For example:

<apex:page standardController="Account" extensions="AccountExt" standardStylesheets="true" applyBodyTag="false" docType="html-5.0" title="My Wizard">
	<apex:form id="theform" >
		<apex:pageBlockButtons >
			<apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
			<apex:commandButton value="Search" action="{!doSearch}" />
		</apex:pageBlockButtons >
		
		<apex:pageBlockSection title="Test">
			<apex:inputfield value="{!account.Type__c}" required="true"/>
		</apex:pageBlockSection>
	</apex:form>
</apex:page>

After some research, I realised this is actually related to the behavior in HTML 5 (doctType=”html-5.0″) where it will automatically validate all the required fields that I have in a form. So, how can we overcome this?

Option 1 (Form level)

You can set an HTML 5 attribute called html-novalidate=”novalidate” at the form level. However, this will disable the validation for all buttons. You should only use this if you have your own validation logic implementation in the controller/extension class.

<apex:form id="theform" html-novalidate="novalidate" >

Option 2 (Button level)

You can have the similar attribute next to the command button to disable the validation on the button specifically.

<apex:commandButton value="Cancel" action="{!cancel}" immediate="true" html-formnovalidate="formnovalidate" />

This is a better option to go for as we do not need to worry about implementing the additional logic to validate the user input.

Need your Salesforce Inventory linked to Xero or Saasu?

Want to load data from Xero or Saasu?

We’ve added more functionality to our highly successful product, RIO Readymade Inventory Plus. You can now transfer data from Xero or Saasu to RIO Readymade Inventory Plus.

Can I use other csv data files?

Yes! The program can also handle any csv file in the required format.

How does it work?

  1. Send us an email at support@wdcigroup.net and we’ll send you the job.
  2. The upsert uses Skyvva data loader. Skyvva can be downloaded for free.
  3. Install Skyvva (this app is available on Appexchange).
  4. Install our job
  5. Download the data from Xero/Saasu
  6. Follow the instructions to upload your data to Salesforce.

What if I need some help?

Videos and documentation are available here.

Build on Salesforce features. Can I automate it?

Subscribe to Skyvva and you can email the data to automate the process

Salesforce Apex: Namespace and Field Name in AggregateResult

In Salesforce SOQL, we can use the aggregate function to summarize data in query. When an aggregate function is used, Salesforce will return the result as AggregateResult object and we can retrieve the value by calling AggregateResult.get(‘field name’). For example:

for(AggregateResult ar : [select count(Id), Business_Type__c from Account group by Business_Type__c]){
	system.debug(ar.get('expr0'));		//get the value of count(id)
	system.debug(ar.get('Business_Type__c'));	//get the grouped by field value
}

However, things get a little bit tricky when you have a namespace in the Salesforce instance and you have custom field in the SOQL. The sample query will still work, but you will get an error saying “Invalid aggregate result field” when you are trying to retrive the value of custom field.

To overcome this, you can choose to:

Option 1

Prepend the custom field with a namespace, for instance,

system.debug(ar.get('namespace__Business_Type__c'));	//get the grouped by field value

Option 2

Use alias in the SOQL to represent a custom field in query result.

for(AggregateResult ar : [select count(Id), Business_Type__c businesstype from Account group by Business_Type__c]){
	...
	system.debug(ar.get('businesstype'));	//get the grouped by field value
}

Personally, I would prefer to use Option 2 as I don’t have to hard code the namespace in all the SOQL.