ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [Salesforce Administrator] Global Variable
    Salesforce 2025. 3. 3. 21:35

    Global Variable

    • $로 시작하는 변수로 Salesforce 전역에서 사용가능한 공통 변수

     

    Global Variable 종류

    • $Action
      • $Action.object.action 같은 형식으로 $Action.Account.New 처럼 사용한다.
      • Custom Button, Link / S-Control / Visualforce Page에서만 사용이 가능 (LINKTO 및 URLFOR 함수에서 사용)
    // Visualforce
    <apex:outputLink value="{!URLFOR($Action.Account.New)}">
        Create New Account
    </apex:outputLink>

     

    • $Api
      • formula fields / S-Control / Custom Button, Link / Visualforce Page / Flows / Process Formula에서만 사용이 가능
      • $Api.Enterprise_Server_URL__ apiversion : Enterprise WSDL SOAP 엔드포인트
      • $Api.Partner_Server_URL__apiversion : Partner WSDL SOAP 엔드포인트
      • $Api.Session_ID: 현재 컨텍스트의 세션 값을 나타내고, 세션 컨텍스트는 요청의 도메인을 기반으로 하기 때문에,  .salesforce.com에서 .vf.force.com으로 호스트 이름 경계를 넘을 때마다 변경된다.
    • $CustomMetadata
      • Validation Rule Formula에서만 사용이 가능하며, $CustomMetadata.type.record.field 이런 형식으로 사용
    • $FieldSet
      • Visualforce Page에서만 사용이 가능하며, 오브젝트의 fieldSet 집합을 동적으로 할당하기 위해 사용
    <apex:page standardController="Account">
        <apex:repeat value="{!$ObjectType.Account.FieldSets.myFieldSetName}" var="field">
            <apex:outputText value="{!field}" />
        </apex:repeat>
    </apex:page>

     

    • $Label
      • Custom Label 데이터를 사용 (Aura / Visualforce / Apex / flow에서 사용 가능
      • $Label.helptext 이런 형식으로 사용
    • $Permission
      • 현재 사용자의 permission access를 조회
      • {!$Permission.deleteCandidates} : 현재 사용자에게 deleteCandidates의 Permission이 있는지 확인
    • $Profile
      • 현재 사용자의 Profile 관련 정보를 조회
      • $Profile.Name 같은 형식으로 사용 가능
    • $User
      • 현재 사용자에 대한 정보를 참조할 때 사용한다.
      • Formula에서 {!$User.FirstName} & “ “ & {!$User.LastName} 같은 방법으로도 사용한다.
    • UserRole
      • 현재 사용자의 Role 관련 정보를 조회할 때 사용한다.
    • $Site
      • 현재 Salesforce 사이트에 대한 정보를 참조할 때 사용한다.
      • Visualforce / email template / S-Controls에서 사용 가능
      • $Site.Name : 현재 사이트의 API Name을 반환
      • $Site.Domain : Salesforce Site 기반 URL을 반환
      • $Site.IsPasswordExpired : 인증된 사용자의 경우, 현재 로그인한 사용자의 비밀번호가 만료되면 true를 반환 / 인증되지 않은 사용자의 경우 false를 반환
      • $Site.BaseCustomUrl : 현재 사이트의 기본 URL을 반환

     

    출처)

    https://help.salesforce.com/s/articleView?id=platform.dev_understanding_global_variables.htm&type=5

Designed by Tistory.