Skip to main content

Posts

Salesforce DX Packages - simple recipe to remove apex classes dependencies

With the recent release of Salesforce DX and the package development model it got me thinking how to avoid dependencies so I can isolate my packages.  Business case The major pain point I saw in the past was around "how to split the metadata so separated teams can work in parallel". For instance, a  team can be one line of business or a stream in a project or a feature.  In the old monologic development approach (AKA "the happy soup") we used to have these big merge sessions in order to integrate and some times re-write incompatible solutions written in parallel by separated teams  (I won't miss those long nights with cold pizza) .  Due to several comments of the merge complexity, Salesforce decided to invest in a better way to allow teams to split their work and this is where the new unlocked packages come into place. However, in order to fully benefit from the  advantages of unlocked packages  we have to deal with dependencies between pack
Recent posts

Salesforce ListView as a Home Page component.

Display ListView as a Home Page component. In this show an example to use the a pex:enhancedList  VisualForce component in order to display a ListView in a VisualForce Page, and then embed this as a Home Page component. The final result should be something like this: Step 1: Create a ListView I suggest doing this with a ListView, as we left the control of which records list will be filtered to Administrators or End users. First step its to create a list view with the data that you want to show: Step 2: Create a VisualForce Page  Go to  Setup -> Build --> Develop --> Pages --> New. And create a new Page with this sniped of code: The page is using an  enhancedList Visualforce Component, for more details about this component here is the documentation: http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_composition.htm|StartTopic=Content%2Fpages_compref_composition.htm|SkinName=webhelp   The par

How to ByPass and Apex Triggers and Avoid Loops

How to ByPass and Apex Triggers and Avoid Loops Sometimes, when developing a trigger from some reasons we need to by pass the a trigger, may, as I mentioned in my previous post " System.LimitException: Too many SOQL queries: 101 ", sometimes we have loops in our triggers logic.  In Other occasions we just want to bypass because records were processed previously. Our first approach for bypassing its to execute an SOQL query to see if record need to be processed or use fields in the object. trigger TriggerTest on User (before insert. before update) { //First go to Database Set ids = Trigger.newMap.keySet(); List relatedObjs = [SELECT Id,Name FROM relatedObject__c WHERE parent__c in :ids]; //Here check which users need to be processed. List UsersToProcess = new List (); for(User usr: Trigger.new){ //Use the values on relatedObjs to validate UsersToProcess.add(usr); } //Process the records if(UsersToProcess.size() > 0){

Salesforce Apex Too many SOQL queries: 101

System.LimitException: Too many SOQL queries: 101 Overview This Exception is thrown when our code goes over the 100 SOQL queries  (Select, Insert, Update, Upsert, Delete) in a single apex transaction. That governor limit is shared between all triggers executed. This means it’s a counter of SOQLs quieres per transaction increased differently by each trigger executed. Therefore we can say that the “Too Many SOQL” Exception it’s a “ Shared blame issue ”. Most common causes that I have seen are due to: „ Triggers are not bulkified. Tigger’s Loops. Features are not grouped efficiently.  Since it’s a “ Shared blame issue ” the exception can be thrown at any place. Maybe not in the trigger or class which it’s contributing the most to the counter. Therefore, to fix it we have to narrow down and validate couple of things. 1.   Verify that your triggers are bulkified. A Bulkified Code, means the code was adapted so triggers can support big number of records been m

Salesforce1 Simulator for Google Chrome

Salesforce 1 Simulator for Google Chrome  Salesforce 1 Simulator allows you to view and test drive your SF1 Apps using different devices. Make sure you have Google chrome installed before following the next steps. http://www.google.com/chrome/   And you should have a Salesforce Account with Salesforce 1 access properly configured. http://www.salesforce.com/salesforce1/rolloutguide/gettingstarted.jsp Step 1  - Download the Salesforce1 Simulator  : Go to this link and install the simulator https://chrome.google.com/webstore/detail/salesforce1-simulator/cknbjckicenodbiaejbmkjhldffonggp Step 2  - Open Salesforce 1 Simulator from Google Chrome apps. Click the Apps icon In the bookmarks bar. If you don't see the Apps icon, right-click the bookmarks bar and click Show Apps Shortcut. Click the Salesforce 1 app to open it. Step 3  - Connect to your org with your credentials. Step 4  - Test your Apps. Once you log in you can access all yo

Dynamic Section on a VisualForce Page

This will be an small example to show how to create dynamic content inside a Visual Force Page, particularly in a table. Additionally the idea that I wan to introduce here its the use of a Wrapper Class , This class will help us to control the User Interface behavior without having the need to have a new field (Persistent data) back into the database. This we we can "Wrap" the database information into another object, use it in the Interface and them just save back the important information. Something important to consider when using a wrapper class, its there is not automatic field type binding in the VisualForce page to not persistent objects, therefore we need to use fields like "<apex:inputText  /> " Instead of  <apex:inputField /> and validate the format of the data that we collect from the view. The requirements: Have a table that show basic account information. When the checkbook "Configure SLA" its selected allow user to chang