분류 전체보기30 [Developer Beginner] Apex Testing | Get Started with Apex Unit Tests github.com/developerforce/trailhead-code-samples/blob/master/VerifyDate.cls 출처 developerforce/trailhead-code-samples Public code samples to support Trailhead challenges - developerforce/trailhead-code-samples github.com public class VerifyDate { //method to handle potential checks against two dates public static Date CheckDates(Date date1, Date date2) { //if date2 is within the next 30 days of d.. 2021. 3. 22. [Developer Beginner] Apex Triggers | Bulk Apex Triggers 이거 만들려면 task에 WhatId라는 custom field를 추가해줘야 하는데, task 오브젝트에선 못한다. 대신 Activity 오브젝트에 필드를 추가해주면 된다. trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) { List tasks = new List(); for(Opportunity o : Trigger.New) { if(o.StageName == 'Closed Won') { tasks.add(new Task(Subject='Follow Up Test Task', WhatId=o.Id)); } } insert tasks; } 2021. 3. 22. [Developer Beginner] Apex Triggers | Get Started with Apex Triggers 오 통과ㅋ trigger AccountAddressTrigger on Account (before insert, before update) { //BillingPostalCode //ShippingPostalCode //Match_Billing_Address__c is true, // 위는 정확한 API명 //billing postal code true && match_billing accress__c true일 때 //shipping postal code를 세팅할 것 for(Account a : Trigger.New) { if(a.Match_Billing_Address__c == true && a.BillingPostalCode != '') { a.ShippingPostalCode = a.Billing.. 2021. 3. 22. [Developer Beginner] Apex Basics & Database | Write SOQL Queries 처음엔 mailingPostalCode에서 에러 나더니 또 되네; 왜 그런담 public class ContactSearch { public static List searchForContacts(String lastName, String mailingPostalCode) { List answer = new List(); Contact[] conList = [SELECT ID, Name FROM Contact WHERE LastName=:lastName AND MailingPostalCode=:mailingPostalCode]; //lastname = a && mailingPostalCode = b //cf. MailingPostalCode //return Contact records[] list, inc.. 2021. 3. 19. 이전 1 2 3 4 5 6 ··· 8 다음