본문 바로가기

Develop/Salesforce

(7)
Apex Testing Apex Test Code 예제를 보며 System.assertEquals() , System.assert()를 사용하여 예외 케이스까지 테스트 해본다. public class AccountService { // Enum to represent Account Levels public enum AccountLevel { STANDARD, PREMIUM, VIP } // Method to update the Account Level based on revenue public static void updateAccountLevel(Id accountId) { Account account = [SELECT Id, AnnualRevenue FROM Account..
Get List of Profiles that are visible to a particular tab How can I get a list of profiles visible on a particular tab? //get all Tab names to do a query of prmissionSetTabSetting List tabList = [SELECT Label, Name, Url From TabDefinition ORDER BY Label]; Map tabMap = new Map(); for(TabDefinition tab : tabList){ tabMap.put(tab.Name, tab); } //Querying using a nameset List targetList = [SELECT Parent.Profile.Name, Parent.Iscustom, Name, Visibility FROM ..
[Salesforce] Way2 ) How to print a Lightning Component Create Lightning App to call lightning component in it Step1) Create the Lightning Component that you want to print PrintComponent.cmp 출력 Step2) Create Lightning App to call the lightning component in it PrintCmp.app PrintCmpController.js ({ scriptsLoaded : function(component, event, helper) { component.set("v.isLoaded", true); setTimeout(function(){ window.print(); }, 2000); } }) step3) Use @me..
[Salesforce] Way1 ) How to print a Lightning Component Rendering the Lightning Component to the Visualforce page Add Aura component to your Visualforce pages to combine features you've built using both solutions. Implement new functionality using Aura components and then use it with existing Visualforce pages. 구축한 기능을 포함하여 아우라 컴포넌트를 비주얼포스 페이지에 더할 수 있다. 아우라 컴포넌트를 이용하여 새로운 기능을 상속하고 기존의 비주얼 포스 페이지에서 사용한다. There are three steps to add Aura components to..
[Salesforce] pass value from Child component to Parent component 참조 > 사용하게 된 계기 : 버튼을 보여주는 컴포넌트 아래에 modal을 만들지 않고, 자식 컴포넌트에 modal을 생성해서 버튼 클릭시에 보여주려고 했다. ParentComponent //isLoaded 변수에 따라 childComponent의 modal창을 보여줄지 말지 결정하기 위해서 ({ callChildComponent : function(component, event, helper) { component.set('v.isLoaded', true); }, getParams : function(component, event) { //get method paramaters var params = event.getParam('arguments'); if(params) { var param1 = pa..
Getter/Setter Method Getter Stter는 왜 그리고 어떻게 쓰는 걸까? 필드, 즉 프로퍼티(속성)을 사용하기 위해서 사용한다. 쉽게 말하면, get -> 값을 읽는다. set -> 값을 적용, 쓴다. get and set are Accessors, meaning they're able to access data and info in private fields and usually do so from public properties. -> get과 set은 접근제어자이다. 즉, private 필드의 데이터와 정보에 접근할 수 있고, 공용 프로퍼티에서 접근할 수 있다. public class ApexProperties{ //Using both getters and setters. read-write public Intege..
[Salesforce] how to set exception message This is useful when you want to display the message of Exception handling in the controller on the screen. Exceptions can be top-level classes, so your custom exception class must extend exception. All exception classes extend the system-defined base class Exception, and therefore, inherits all common Exception methods. Let me give you an example of how this is the way I used it. 1) At the top o..