Skip to main content

Random Positive Integer in Salesforce Apex



Here is a code to generate a Positive Number, as parameter this method the the Maximun that can be generated.


Comments

Popular posts from this blog

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

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