Friday, November 30, 2012

Setting up global email address for your organization in Force.com

When you set up workflow to send out emails in Force.com platform, you can set the from address to a generic email address of the organization. For example, instead of your own email address you could use contact@yourcompany.com. 

To be able to set these standard email address as from email address, you first need to set it up using a feature called organization-wide address.

Go to Administration Setup -> Email Administration -> Organization-Wide Addresses. By clicking on the 'Add' button you can enter an email address. You can use this across all profiles or limit to only certain profiles to use as from address.

Once the email address is added, a verification email is sent to that email address. The verification email provides a link where you can go and verify the email address. Until the verification is done, platform keeps that email address in 'Verification Request Sent' status. Once the verification is done, status changes to 'Verified'.

You will be able to use any of the verified status organization-wide email addresses as from email address for email alerts.

Happy cloud computing using Salesforce!

Creating Workflow Action for sending out email alerts in Force.com

One of the workflow actions that we can set up to execute in Force.com platform is 'Sending out Email alerts'. Let us explore the steps involved in setting up this type of workflow action using Force.com platform.

From the App Setup -> Create -> Workflow & Approvals -> Email Alerts, you can create new email alerts and use it while setting up workflow actions.

Otherwise, while setting up workflow actions you can click on 'New Email Alert'. Both actions take you to the same page.



Enter Description for the Email Alert you are setting up. If you had come into this page via the 1st route mentioned above, you will need to select the object to which this email alert belongs to.  In the 2nd route, the object you have selected for the workflow rule is automatically selected for the action as well.

Email Template need to be specified. There are some standard email templates provided by the platform. If you need your own customized template, you must set up your email templates  in advance via Administration Setup -> Communication Templates -> Email Templates.

Email Recipients must be specified. There are 2 different ways you can specify who should receive the alerts. If your alert is going to someone in your organization, look for the recipient by Recipient Type. Based on your selection in the type, you get the Available Recipients list. You can select recipients among them. You may also specify up to 5 additional free form email addresses at the bottom section, if the recipient is someone outside your organization network in the Force.com platform.

From Email Address can be set to workflow user's email address or one of the organization-wide address that has been set up.

Save your work. If you created a new email alert, go ahead and associate it with a workflow rule and you will have a workflow action for sending out emails.

Happy cloud computing using Salesforce!

Thursday, November 29, 2012

New Task option for Add Workflow Action in Force.com is missing

One of the workflow actions that we can set up in Force.com platform is a task assignment. So, you have a new custom object and you are setting up workflow rules for this object. You want to add a new task for workflow action. However, on the 3rd step of creating workflow rule, you do not see 'New Task' option under 'Add Workflow Action'. So, what are you missing?

When creating the custom object, there was an optional feature called 'Allow Activities'. You probably did not check that option. Go to the Edit page for your custom object and scroll down. You will see a section called 'Optional Features'.



Check 'Allow Activities', save and add workflow action now. The 'New Task' option will be available.

Happy cloud computing using Salesforce!

Wednesday, November 28, 2012

Setting up Workflow Actions in Force.com

As we learnt in Creating Workflow Rules in Force.com, the 3rd step is to specify the workflow actions that will be executed when the rule criteria are met. Let us now learn how to set up workflow actions in Force.com platform.

When you are in 3rd step of the workflow rule creation process which is specifying workflow actions, you will see 2 different sections. Immediate Workflow Actions and Time-Dependent Workflow Actions.

Immediate Workflow Actions - As the name indicates, the actions set up here executes instantly when the rule criteria are met.

Clicking on the 'Add Workflow Action' button gives you option for either selecting an existing action or creating a new action. As we learnt before in Workflow and Approval Process article, the action could be a Task, Email Alert, Field Update or Outbound Message. You can set up one or more actions of the same type or combination.

Time-Dependent Workflow Actions - Actions that you can set up in this section are same as above but they are time dependent. You add a 'Time Trigger' first and then add workflow actions  to that time trigger. The time trigger adds a delay before the action executes. This delay could be in terms of Days or Hours and could be before or after. You can add multiple time triggers. And just like the immediate workflow actions, you can set up one or more more actions of the same type or combination to each time trigger.

For example, you can set up field update and task assignment actions to execute 5 hours after an opportunity is closed. You can set up task assignment and email alert actions to execute 30 days after an opportunity is closed.

We will see each of the action types in detail in our future articles.

Happy cloud computing using Salesforce!

Workflow Rules Filter Logic in Force.com

In the article Understanding Workflow Rule criteria we left out the section 'Add Filter Logic'. Let us explore now and see how can we utilize this feature in Force.com platform. 

The Workflow Rule Criteria in Force.com platform gives two different choices to run the rule - 1. criteria are met. 2. formula evaluates to true.

In the 1st choice, when we are defining the criteria, as you can see there are multiple rows we can fill in. At the end of each row, you see an 'AND' literal. That means criteria specified in each row is logically ANDed to come up with the final criteria.



Let us take a simple example. 

Say our requirement is to find all Opportunities for new customers with amount is more than 10000.

1st Row - Opportunity: Type equals New Customer
2nd Row - Opportunity: Amount greater than 10000

This translates the rule criteria into -

(Opportunity: TypeEQUALSNew Customer) AND (Opportunity: AmountGREATER THAN10000)

which is in other words, (Row 1 AND Row 2)

The rule criteria works fine and we find the records we want. Now let us change our requirement a bit.  

Say our requirement is to find all Opportunities for new customers with amount is more than 10000, and all other opportunities if the amount is more than 25000 regardless of new or existing customer.


1st Row - Opportunity: Type equals New Customer
2nd Row - Opportunity: Amount greater than 10000
3rd Row - Opportunity: Amount greater than 25000


This would translate to -


(Opportunity: TypeEQUALSNew Customer) AND (Opportunity: AmountGREATER THAN10000AND (Opportunity: AmountGREATER THAN25000)


or (Row 1 AND Row 2 AND Row 3)

As you can see, this doesn't result into exactly what we are after. Instead, the result of this would be exactly same as the 1st expression. This is where 'Filter Logic' is applied to get the right result. Click on the 'Add Filter Logic' link at the bottom. You will see the following -



See the Filter Logic that says 1 AND 2 AND 3. We change this into (1 AND 2) OR 3 to get our result. Now the rule criteria changes into -

((Opportunity: TypeEQUALSNew Customer) AND (Opportunity: AmountGREATER THAN10000)) OR (Opportunity: AmountGREATER THAN25000)

Thus getting us all opportunities of amount more than 25000 along with new customer opportunities with amount more than 10000.


Now let us change our requirement once again.  

Say our requirement is to find all Opportunities for new customers with amount is more than 10000, and all other opportunities if the amount is more than 25000 regardless of new or existing customer,  only if the opportunities are at negotiation stage.

1st Row - Opportunity: Type equals New Customer
2nd Row - Opportunity: Amount greater than 10000
3rd Row - Opportunity: Amount greater than 25000
4th Row - Opportunity: Stage equals Negotiation/Review

And we have Filter Logic from the previous step as (1 AND 2) OR 3. Now we need to add the 4th row into the logic as per our new requirement.

We have 2 expressions separated by an OR. We need to make sure both returns the opportunities that are only at negotiating stage. So ideally we AND our 4th row into both, giving us (1 AND 2 AND 4) OR (3 AND 4). We could also take out the 4 outside and come up with ((1 AND 2) OR 3) AND 4

That is how filter logic is used while creating workflow rules. This same filter logic is useful while filtering report data as well. As you can see it can get tricky with complex filtering requirements. Choosing the right filter and grouping them in proper parentheses will make it easier.

Happy cloud computing using Salesforce!

Tuesday, November 27, 2012

Understanding Workflow Rule criteria in Force.com

In the article Creating Workflow Rules we learnt the steps involved in creating workflow rules in Force.com platform. In this article let us explore the step of defining the rule criteria. 

In Step 2 while creating the workflow rule, after you enter the rule name and description, you have 2 sections - Evaluation Criteria and Rule criteria as shown below. 



They both work together to determine when the rule is executed. Let us go in the reverse direction. First let us see what is Rule Criteria and then Evaluation Criteria.

Rule Criteria - Rule Criteria defines when to trigger the rule. You can define this based on the combination of field values or based on a formula evaluation. 

Let us take a very simple example to understand this better. 


  • Say you have an object called Invoice with a field named Status of values 'Open' and 'Closed'. 
  • You want to perform some action when the status of each invoice record is closed.
  •  You would define the rule criteria as 'Status' equals 'Closed'
This defines the criteria to trigger the rule when status is changed to closed for invoice record. However it is not that straight forward. As we can see below the evaluation criteria controls this further.

Evaluation Criteria - This defines when to evaluate the rule criteria. Only when this criteria is met, the rule criteria is evaluated and triggered if met.  There are 3 different choices.

  • created - This indicates evaluate the rule criteria each time a record is created. That means rule is evaluated only once when record is created. Hence in our example this option would indicate each time when an Invoice record is created, since evaluation criteria is met, rule criteria is evaluated and hence checked if the Invoice is created with 'Closed' status. If it is not created with 'Closed' status, no action is performed. Rule is never triggered again for this record even if the invoice changes to 'Closed' later on.
  • created, and every time it's edited - This indicates evaluate the rule criteria each time a record is created and updated. Hence in our example this option would check if the Invoice status is 'Closed' when a record is created as well as each time the record is updated.
  • created, and any time it's edited to subsequently meet criteria - This is same as the above but the difference is it makes sure when the record is updated the rule criteria is really met as part of the update. In other words, it ignores the record edits that are not relevant to the rule criteria. In our example, say Invoice Status is updated from 'Open' to 'Closed' -  Rule criteria is evaluated and triggered since status was changed to 'Closed'. Now say Invoice record is updated again to correct the customer address zip code - Rule criteria is not evaluated though the Invoice status is 'Closed'. Platform will understand that the update is not related to the status change.
That is how we set the rule criteria. On this step there is one more item which is part of rule criteria called 'Add Filter Logic'. We will cover this in the next article.

Happy cloud computing using Salesforce!

Monday, November 26, 2012

Creating Workflow Rules in Force.com

In one of our previous articles we learnt what is Workflow and Approval Process in Force.com platform and how it is important for any organization. We also learnt that workflow is made up of Workflow Rules. 

Workflow rules define rules for workflow step. It defines the criteria, the schedule and the execution plan for the workflow actions. In this article let us explore how to create those rules using the Force.com platform.

To create a workflow rule go to App Setup -> Create -> Workflow and Approvals -> Workflow Rules. Then click on the 'New Rule' button.


Step 1 - You select the object to which your workflow rule applies. Each rule applies to a single object
Step 2 - You enter the rule name and description. You define the rule criteria.

Step 3 - You specify the workflow actions that will be executed when the rule criteria are met.

Save the workflow rules and activate it from the workflow rule detail page. As far as the overall steps go it is as simple as this. But both Step 2 and Step 3 are much involved. Both steps deserve an article itself to get a good understanding. Coming soon!

Happy cloud computing using Salesforce!

Saturday, November 24, 2012

Workflow and Approval Process in Force.com

In any organization there are number of scenarios where processes are so standard and could be easily automated to reduce the delay or gap between the steps. The Workflow and Approval Process components in Force.com platform covers these requirements. 

Creating the  business logic based on the requirements and implementing the workflow process in the platform is an easy task just like other features we have been exploring in the previous articles. We create rules to customize processes. Using these rules we can automate the processes. 

The workflow component in the Force.com Platform allows us to perform the following -

Assigning Tasks. Tasks can be assigned to a user, a role or the record owner. For example, automatically assign a task to a representative for conducting customer satisfaction survey after a week of selling your product or service.

Field Updates. Value of a field in a record can be updated to new value. For example, when Status of an order is changed to 'Closed', the closed date can be automatically set.

Send Email Alerts. Emails can be sent out to one or more recipients. For example, when the status of an order is set to 'Shipped', email can be automatically sent out to the buyer.

Send API Messages. XML format API messages can be sent out to designated listener. For example, send out an outbound API message to an external HR System for initiating the expense reimbursement process.

Workflow automates processes. Approvals take care of the automatic approval of a record. An approval process can specify when to approve and who should approve a record. You can also specify the actions to take when the approval process is executed. 

Let us see some classic examples for approval process usage. 

*    An employee leave approval policy where different people or roles or departments have to approve depending on various criteria. 

*    Expense report approval policy where if within a certain amount may be it is automatically approved, and beyond  certain amount it may need approval by different people.

*    Employee recruiting process where depending on which department employee is being hired, process needs approval from different people starting from opening up that post in the organization to employee coming on board.

As you can see Workflow and Approval process could be so much useful to any organization. In the upcoming articles let us explore how to configure these components in the platform.

Happy cloud computing using Salesforce!

Wednesday, November 21, 2012

Page Layout Editor in Force.com

As you might have seen so far, when you added custom objects, you could make the platform automatically create pages for data entry/editing. If you have only few fields, it is not a problem. But when you add number of fields, you certainly want to move things around, organize how those fields are grouped together, set which fields are visible/read only or required and so on. There comes handy the Page Layout Editor.

Force.com platform provides the tool Page Layout Editor using which one can easily organize the page just by simple point and click and drag things around. Let us see how to access this tool and what all it has to offer.

Go to the object definition detail page via App Setup -> Create -> Objects and then clicking on the link for your object label and scroll down a little to see Page Layouts section. You can click on 'New' to create a new Page Layout or click on Edit for an existing one. Go ahead and click on Edit. The page displayed is the Page Layout Editor.

Page Layout Editor displays your current page layout along with a toolbar and a palette at the top with different user interface elements that you can use. As you can see each and every control and section in the page layout is clickable. Then you can move it around by simply dragging and dropping it to the required location. You can set the properties by clicking on the wrench icon. You can also delete it altogether by clicking on the delete icon.

The palette provides 3 different categories - Fields, Buttons, Related Lists. Fields category provides you 'Section' and 'Blank Space' user interface element along with all the fields. You can simply drag and drop it on the page layout wherever you want. Buttons category provides you the list of buttons you could have. Related lists allows you to manage the detail records lists. 

The toolbar provides buttons for saving and previewing. Check out the preview, you can preview using different roles. This is important because though you have organized all the fields and sections to your satisfaction, users in all different roles may not see it the same due to some fields being not visible to them etc.

Also, as you can see when you scroll down the page layout both the toolbar and the palette moves with it and hence always visible, making it so easy to work with the editor.

That is such a simple and easy to use tool. At the same time quite powerful as to what you can do!

Happy cloud computing using Salesforce!

Monday, November 19, 2012

Data validation rules in Force.com

We all make mistakes when entering data and we expect the application to catch all those errors. For example a 'Quantity' field in an order submission form. Does it make sense if user enters a zero value or a -ve value for it? Applications need to have a way of verifying if the data entered is sensible. Force.com platform provides a built-in feature, an easy way to catch all those errors by letting the developers define validation rules for the fields.

Let us learn the steps involved in putting together a validation rule. 


Step 1 - Decide the object and the field for which you will be adding a validation rule. For your object of choice go to its object definition detail page via App Setup -> Create -> Objects and then clicking on the link for your object label.


Step 2 - There you will  see a link (towards the top) called 'Validation Rules'. Or just few sections below, you will see a section called 'Validation Rules' with a button 'New'. Either click on this 'New' button or hover over the top link and click on the 'New' button there.

Step 3 - You will be taken to a page where you are allowed to enter Rule Name, Description, Error Condition Formula and Error Message to display. Error Condition Formula section is where we spend our time coming up with the validation rule. But wait a minute! Have you read my previous article Custom Formula Fields in Force.com? If you have read it and have spent enough time to come up with 'Custom Formula' Fields, this section should look very familiar. Go ahead, play with this section and put together your validation rule.

Step 4 - Enter the Error Message you want to display when the 'Error Condition Formula' you have setup is true and the location for the message to be displayed.

Go ahead and save your validation rule. That was quick and easy isn't it?

Happy cloud computing using Salesforce!

Friday, November 2, 2012

Custom Formula Fields in Force.com

The general fields store values entered by users. There are times we want to apply calculation on these values and come up with the result. Formula fields in Force.com platform does the exact same thing.  Formula fields are nothing but the calculated fields. In other words, you apply a formula on the fields that store data. This calculates the required value and returns the result without changing the underlying data.

Force.com platform provides all required operators including logical operators and many functions to perform our calculations. Go ahead and try it out.

Add a new custom field and select 'Formula' for Data Type. Continue with the next step, enter the usual Field Label and Name, also select the Return Type. Return type is the type of the result you are expecting from your calculation. Move on to next step, switch to 'Advanced Formula' tab and this is where all the fun starts. 

There is an editor where you come up with your calculated field or custom formula field. Platform provides you with 4 different options to help you out.

Insert Field - This button provides the list of data storing fields that you could use in your formula.

Insert Operator - This button provides all the operators that platform provides.

Functions - Scroll down this list and see the number of functions you have to come up with your formula. Click on the function and a quick helper text is displayed about the selected function.

Check Syntax - At the bottom of the editor, there is a button called 'Check Syntax'. When you have your formula ready, you don't have to store it without knowing whether it is syntactically correct. Use this 'Check Syntax' button and this will validate your formula.

That is it! With the help of these 4 options you can write a simple or complex formula, validate    and store it as a Formula Field.

Happy cloud computing using Salesforce!