2019年3月25日 星期一

Salesforce執行commandbutton前出現確認視窗

Salesforce執行commandbutton前出現確認視窗

請使用以下方式才可以
<apex:commandButton value="Warning" onclick="if (!confirm('Do you want to proceed?')) return false;" action="{!sort}" rerender="updateArea" />

2019年1月7日 星期一

Disable browser caching for Lightning Components


Disable browser caching for Lightning Components


  • From Setup, locate the link to ‘Session Settings’
  • Locate the ‘Caching’ section
  • Uncheck the option to ‘Enable secure and persistent browser caching to improve performance’



URL:https://www.desynit.com/dev-zone/salesforce-development/disable-browser-caching-for-lightning-components/

2019年1月3日 星期四

Lightning Edit Form Picklist無法正常顯示問題


Lightning Edit Form Picklist無法正常顯示問題

於recordEditForm需指定RecordTypeId

且Account initial時要初始化RecordTypeId

2018年12月26日 星期三

2018年12月17日 星期一

於Salesforce Lightning中判斷使用裝置

How To Detect a Device In Salesforce Lightning Component ?


{!$Browser.isTablet}      > To detect the tablet device
{!$Browser.isPhone}      > To detect the user is in Mobile Phone / mobile browser
{!$Browser.isAndroid}   > To detect the user is in Android device
{!$Browser.formFactor} > Returns a FormFactor enum value based on the type of hardware the browser is                                                            running on.
DESKTOP for a desktop client
PHONE for a phone including a mobile phone with a browser and a smartphone
TABLET for a tablet client (for which isTablet returns true)

Component:
<aura:component>
 
    <aura:if isTrue="{!$Browser.isTablet}">
     You are using a tablet device
        ( <lightning:icon iconName="utility:tablet_portrait" size="x-small" alternativeText="Indicates approval"/> ).
    </aura:if>
    <aura:if isTrue="{!$Browser.isPhone}">
        You are using a phone
        ( <lightning:icon iconName="utility:phone_portrait" size="x-small" alternativeText="Indicates approval"/> ).
        This message is rendered using isPhone <br />
    </aura:if>
    <aura:if isTrue="{!$Browser.isIPhone}">
        You are using an IPhone, If it is IPhone X, _/\_ <br />
    </aura:if>
    <aura:if isTrue="{!$Browser.formFactor == 'DESKTOP'}">
     You are using a DESKTOP
        ( <lightning:icon iconName="utility:desktop" size="x-small" alternativeText="Indicates approval"/> )
        Browser device
    </aura:if>
    <aura:if isTrue="{!$Browser.formFactor == 'PHONE'}">
     You are using a Phone, This message is rendered using formFactor
    </aura:if>
    <aura:if isTrue="{!$Browser.formFactor == 'TABLET'}">
     You are using a Table device
    </aura:if>
</aura:component>

App:
<aura:application extends="force:slds">
    <c:DetectMyDevice />
</aura:application>

Link:http://sfdcmonkey.com/2018/01/15/detect-device-lightning-component/

2018年10月5日 星期五

Create Re-Usable Custom Lookup In Salesforce Lightning Component – Dynamic


After Installation Please Go To this Link:
Link內容:
STEPS TO DO AFTER INSTALLATION


After Install this,when you will call this component in your lightning component, there you can assign some values as a parameter.


Standard Object:
<c:LightningLookUpBySFDCFUNDA objectAPIName="Contact" nameIcon="custom:custom85"/>


Custom Object:
<c:LightningLookUpBySFDCFUNDA objectAPIName="CustomObject__c" nameIcon="custom:custom80"/>


1) objectAPIName = Correct API Name of you standard/custom objectAPIName. (Ex: objectAPIName="Account")
2) listSize = How many records you want after typing some string. (Ex: listSize="10"), but by default 5
3) readOnly = You can disabled that lookup when you want. (Ex: readOnly="true"), but by default false
4) nameIcon = You can set your icon in the List. (Ex: nameIcon="custom:custom84"), but by default custom:custom57


After calling this component You Need add One Event Handler in Your component:


<aura:handler name="selectRecordIdEvent" event="c:LightningLookUpEventSFDCFunda" action="{!c.handleComponentEventAccount}"/>


And you need to create one Aura Attribute.


<aura:attribute name="accountId" type="String"/>


After adding this you need to go the controller of your component, you can handle the event like below mentioned way:


File :: LightningLookUpBySFDCFundaController.js


handleComponentEventAccount : function(component, event, helper) {
//getting record Id from the event
var selectedIdGetFromEvent = event.getParam("recordIdByEvent");
//getting object API Name from the Event
var objectName = event.getParam("objectAPINameEvent");
//in if condition you need check with exact API Name, which you have provided while creating the component
if(objectName=='Account'){
component.set("v.accountId" , selectedIdGetFromEvent);
}

},

So You can Install This App From: 
Production:
Sandbox:
注意!!!
安裝完需至
LightningLookUpBySFDCFUNDA.cmp將匯入之css移除

不然會影響到Salesforce Lightning版面上的css

<!-- Disable this line
        <ltng:require styles="{!$Resource.SLDSCustomLookUp +'/assets/styles/salesforce-lightning-design-system.css'}"/> 
 -->