New answers tagged

2

There are several issues here. Logic first: List<String> result = PickListController.getPickListValuesIntoList('Contact', testContact[0].Rol__c); testContact[0].Rol__c is a reference to the content of the Rol__c field, as a string, not the name of the Rol__c field itself. It's passed into getPickListValuesIntoList() as the parameter selectedField,...


1

This isn't valid Apex and is not how you invoke a batch class: UpdateUserDataShedule.execute(Database.BatchableContext BC, List <User> scope); To run a batch class, create an instance of the batch and call Database.executeBatch(), just like you do in your Schedulable class: UpdateUserDataBatch u = new UpdateUserDataBatch (); Database....


0

The schedulable class should have the form you have described. The basic content of the batch class should be of the form: global without sharing class BatchProcessName implements Database.Batchable<SObject> { global Database.QueryLocator start(Database.BatchableContext bc) { string qry = 'SELECT id FROM somewhere'; return ...


2

Error: public is not allowed on locals: Reason That error is coming because inside the private static method you have declared public selection Option removed public keyword from List<SelectOption> testoptions = controller.CountryOptions ; Code: public static testMethod void CountryOptionsTest() { property__c prop = new property__c(); prop....


0

Based on the question and the comment "is it possible to take in my custom object Id and query all related object Ids" and you want the IDs from three different types of related object like shown in the question, you cannot do this in a single line of code. However, you could do something like: public static List<Id> getIds(String id) { ...


1

@sfdcfox is correct there is no way to get the page language from the page the way you have it set up, because its not a parameter. You can however dynamically set the page language by passing in the parameter. This question addresses this Assign language Value dynamically in Visualforce page


0

The language attribute isn't a "page parameter" (those are strictly the values found in the URL after the ?). As far as I'm aware, there's no way to get this information from the page. Similarly, there's no way to detect most of the other settings, such as determining if the page is being rendered as a PDF.


0

You can refer to them in the same way you do any other property. If you wish to obtain an Id, you can do it this way: Case.SObjectType.getDescribe().getRecordTypeInfosByDeveloperName().get(<MyNameHere>).getRecordTypeId(); (Note that uses the API Name, not the label) If you're writing a query, you can do it this way: ... RecordType.DeveloperName IN (...


2

Is this currently possible with a LWC or do I have to change my overall approach? You just need a minor tweak. Is there an issue with the way I am calling the Apex Method/Class? Nope. Is there an issue with my Apex Method/Class? Do I have to return data differently? Is something not declared correctly? Only @AuraEnabled properties are serialized. ...


1

You can't do so "automatically." You can, however, check RestContext.request.params to get the value: String param = RestContext.request.params.get('contactId'); This requires some modification to your Apex code.


1

Schema.sObjectType.<sObjectName> is a shortcut for Schema.<sobjectName>.sObjectType.getDescribe(). You can prove this to yourself: System.assert(sObjectType.Contact == Contact.sObjectType.getDescribe()); Also, You can prove that it is indeed a DescribeSObjectResult: Object o = sObjectType.Contact; System.assert(o instanceOf ...


0

It's not hard (Assuming the value to be passed to the test class is the default picklist value).. Create a new Static Method which would retrieve the default picklist Method 1: Apex Method public static string retrieveDefaultPicklist(String sObjectName , String picklistFieldApi) { Schema.DescribeFieldResult fieldSchema = Schema.getGlobalDescribe().get(...


-1

You can delete classes via the Workbench but as all of you know this currently does not work in production environments as it is mandatory that you run all the tests when deleting a class (which is also why Rao's answer won't help). You can, however, do this via a SOAP call using some SOAP request builder. You would have to send a CompileAndTestRequest and ...


2

Id <variable name>= Database.executeBatch(new <Class name>(), batch size); Example code Id batchJobId = Database.executebatch(new Batchtest() , 200); Where 200 is your scope.Scope is not mandatory. If you do not pass scope, default is 200 and maximum you can set is 2000. Note: batchJobId will contain the job Id of the batch.


Top 50 recent answers are included