September, 2016
parent and child relationshiop
ChildRelationship for (ChildRelationship relationship : SObjectType.Parent__c.getChildRelationships()) if (relationship.getChildSObject() == Comp_Profile__c.sObjectType) system.debug(relationship.getRelationshipName()); // you need this in SOQL Favorite
define the width on apex:pageBlockTable columns
columnsWidth=”60%,20%,10%,10%” <apex:page> <apex:pageBlock> <apex:pageBlockTable value=”{! null }” var=”r” columnsWidth=”60%,20%,10%,10%”> <apex:column headerValue=”Name1″> </apex:column> <apex:column headerValue=”Name2″> </apex:column> <apex:column headerValue=”Name3″> </apex:column> <apex:column headerValue=”Name4″> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:page> Favorite
How to test for an exception(‘addError’) in a Trigger
I have a trigger, which detects error conditions and feeds errors to the class or field. This gives a nice result interactively, in the GUI. But how do I write test code to catch these errors ? Is there a System.AssertException(), or the equivalent ? The idea is to: a. Write code in the test […]
Test.startTest() and Test.stopTest()
The test method contains the Test.startTest() and Test.stopTest() method pair, which delimits a block of code that gets a fresh set of governor limits. In this test, test-data setup uses two DML statements before the test is performed. To test that Apex code runs within governor limits, isolate data setup’s limit usage from your test’s. […]
Custom Labels Apex Class
Source Link In Apex use the System.Label.Label_name syntax. You can access these custom labels like this: if(monitoringFrequency == System.Label.daily){ return dateValue.addDays(1); }else if(monitoringFrequency == System.Label.weekly){ return dateValue.addDays(7); }else if(monitoringFrequency == System.Label.monthly){ return dateValue.addMonths(1); } Favorite