apex-code

How to update related cases and fields from one recordtype to other recordtype in lead

点点圈 提交于 2021-01-29 06:52:10
问题 public class UpdaterecordtypeforLead { Public static void Leadtootherupdate() { List<Lead> OlderLead = [SELECT Id,Name, RecordTypeId from Lead where RecordType.Name = 'Enquiries']; List<Lead> NewLead = New List<Lead> (); If(NewLead.Id == null) { for( Lead l : OlderLead) { for(Lead l1 : NewLead) { l1.LastName = l.LastName; l1.Email= l.Email; NewLead.add(l1); NewLead.add(l1); Insert l1; } } If ( (l1. LastName == l.LastName && l1.Email == l.Email)) { NewLead.add(OlderLead.Related_Cases__c);

Why Picklist Not Populating Data for Custom Dependent Picklist Field With lightning:select In Lightning Component

无人久伴 提交于 2020-12-21 02:19:23
问题 I am trying to replicate the below functionality of Custom Dependent Picklist Field With lightning:select In Lightning Component for Custom Object (Ref:- https://sfdcmonkey.com/2018/08/31/dependent-picklist-lightningselect-lightning-salesforce/) , Only difference here is i am using Custom object ERT_Case_Type_Data__c and its 2 picklist Level_1__c and Level_2__c instead of standard object Contact reference in the article Below are ERT_Case_Type_Data__c details Below are ERT_Case_Type_Data__c

Setting Dependent Custom Lightning Picklist Level2 and Level3 then resetting the Level2 at Lightning component but Level2 Cached Data is Getting Saved

廉价感情. 提交于 2020-11-29 21:09:46
问题 Step 1 In a Salesforce Lightning component I have a scenario with three levels of dependent picklists, first I am setting values for picklist Level1, and Level2, then the user selects the dependent picklist value in Level3 Step 2 When I remove the selection at Level2, automatically Level3 selection also gets erased: Step3 Click Save Here is problem, that value selected in Step 1 is getting saved rather than the reset value in step 2. I have added code to reset values at ui:inputSelectOption

Setting Dependent Custom Lightning Picklist Level2 and Level3 then resetting the Level2 at Lightning component but Level2 Cached Data is Getting Saved

ε祈祈猫儿з 提交于 2020-11-29 21:07:32
问题 Step 1 In a Salesforce Lightning component I have a scenario with three levels of dependent picklists, first I am setting values for picklist Level1, and Level2, then the user selects the dependent picklist value in Level3 Step 2 When I remove the selection at Level2, automatically Level3 selection also gets erased: Step3 Click Save Here is problem, that value selected in Step 1 is getting saved rather than the reset value in step 2. I have added code to reset values at ui:inputSelectOption

How To Implement Full Search in Case Type using Salesforce?

左心房为你撑大大i 提交于 2020-11-25 03:51:46
问题 I need to build out a solution to create a search field on the new Case Type Data object in all 3 of the Level fields and populate based on selection. Similar to SF Global Search I would like to type 2-3 characters in the text search field and it would find the matching text in the Level1-3 fields and when selected the Level 1-3 field would populate. This is the apex class public class PickListHandler { @AuraEnabled public static List<String> getLevel1(){ List<String> tempLst1 = new List

How To Implement Full Search in Case Type using Salesforce?

瘦欲@ 提交于 2020-11-25 03:50:20
问题 I need to build out a solution to create a search field on the new Case Type Data object in all 3 of the Level fields and populate based on selection. Similar to SF Global Search I would like to type 2-3 characters in the text search field and it would find the matching text in the Level1-3 fields and when selected the Level 1-3 field would populate. This is the apex class public class PickListHandler { @AuraEnabled public static List<String> getLevel1(){ List<String> tempLst1 = new List

I sheduled an apex class to run everyday, but nothing happens. Can somebody help me out?

帅比萌擦擦* 提交于 2020-07-09 05:13:56
问题 I wrote this APEX class and sheduled it to run every day.I don't get an error message, but unfortunately the class doesn't do anything... Can anybody help me out? global class CustomersDateCheck implements Schedulable { global void execute(SchedulableContext sc) { List<Customers__c> CustomerList = [SELECT Id FROM Customers__c]; DateCheck(CustomerList);} public static void DateCheck(Customers__c[] objects){ for(Customers__c obj: objects){ if(obj.DateField > Date.today()){ continue;} else{obj

Call a apex method from a custom button

末鹿安然 提交于 2020-01-17 08:43:13
问题 i want to call a apex method from a custom Button I realise we can achieve this 2 ways Calling a VF page which in turn calls the method on the page attribute <apex:page standardController="Opportunity" extensions="oppExt" action="{!changeStatus}"/> use javascript to call the webservices method The question i have is on the which is best practice to it for this scenario. Thanks 回答1: It depends on your use case. The API supports both Controllers and Extensions and JavaScript Remoting or

How to unit test works in salesforce?

吃可爱长大的小学妹 提交于 2020-01-11 09:42:09
问题 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();

Lookup field in salesforce is null when saving

爷,独闯天下 提交于 2020-01-06 12:36:23
问题 I have a problem with a standard lookup field. When I try to save it, it has value null when I use autocomplete or just type the name but it works when I use the lookup popup by clicking the lookup-icon. This is (part of) the code. (Not all of it, but even this simple controller and page doesn't work...) Controller: public with sharing class UnresolvedItemsController { public list<TaskItem> myUnresolvedTaskItems {get;set;} public class TaskItem { public string taskId {get;set;} public string