visualforce

How to unit test works in salesforce?

泄露秘密 提交于 2019-12-01 23:30:29
I've done writing code on salesforce and in order to release the unit tests have to cover at least 75% . What I am facing is that the classOne that calls methods from classTwo also have to cover classTwo 's unit test within classOne even though it is done in classTwo file already. File MyClassTwo public with sharing class ClassTwo { public String method1() { return 'one'; } public String method2() { return 'two'; } public static testMethod void testMethod1() { ClassTwo two = new ClassTwo(); String out = two.method1(); system.assertEquals(out, 'one'); //valid } public static testMethod void

How do i get all picklist values from a field in salesforce using REST Api?

我们两清 提交于 2019-12-01 20:35:39
问题 I am trying to get all picklist values from a field in salesforce using REST API. Is it possible to do that? If it is then how it can be done? Thanks, Raj. 回答1: It's very simple. You need to access resource similar to this: /services/data/v26.0/sobjects/Opportunity/describe (use whichever object you want) and the JSON response will contain fields node: 来源: https://stackoverflow.com/questions/14231878/how-do-i-get-all-picklist-values-from-a-field-in-salesforce-using-rest-api

Visualforce Custom Controller List

笑着哭i 提交于 2019-11-29 08:34:14
What I'm looking to do is create a custom controller list that displays a mash up of Opportunities, cases and potentially one other object. I started using the class from the visualforce guide to get me going: public with sharing class CasePagination { private final Case c; public CasePagination(ApexPages.StandardSetController controller) { this.c = (Case)controller.getRecord(); } public ApexPages.StandardSetController CaseRecords{ get { if(CaseRecords == null) { return new ApexPages.StandardSetController(Database.getQueryLocator( [SELECT c.CaseNumber, c.AccountId, c.Subject, c.Status FROM