Javascript plug-in for org hierarchy
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.
{!$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)
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:
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'}"/>
-->
安裝完需至LightningLookUpBySFDCFUNDA.cmp將匯入之css移除
不然會影響到Salesforce Lightning版面上的css
<!-- Disable this line
<ltng:require styles="{!$Resource.SLDSCustomLookUp +'/assets/styles/salesforce-lightning-design-system.css'}"/>
-->
2018年8月23日 星期四
Salesforce Attachment 清單
工具:Salesforce Attachment Manager
https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016cm0EAA
另解
產生DOC再下載
參考:https://success.salesforce.com/answers?id=90630000000gzj6AAA
訂閱:
文章 (Atom)
think about what kind of info you need and create your own csv file ( header)
String csv = 'Account id,Account Name,Attachment Id,Attachment Name\n';
List<Attachment> att=[select id,parentid,parent.type,parent.name,name,ownerid from Attachment where parent.type =:'Account']; String csv = 'Account id,Account Name,Attachment Id,Attachment Name\n'; for(Attachment a:att){ csv+=a.parentid+','+a.parent.name+','+a.id+','+a.name+'\n'; } Document doc = new Document( FolderId = UserInfo.getUserId(), // "My Personal Documents" folder Name = 'ACC_attachments1', Body = Blob.valueOf(csv), ContentType = 'text/plain', Type = 'csv' ); insert doc;
This does not export the attachments, but it will provide a list with id's which then can be used to download it
by pre-fix the attachment id with your Instance URL and then
/servlet/servlet.FileDownload?file=
you can find your repectve URL by navigating to an attachment and right click the view file link copy the url into notepad.
Once you have run this piece of code in the developer console ,
you need to navigate to your personal documents in salesforce
it will show up under the most recent documents
right click the view file and select "save as"
it will predeifined show as CSV so you can oprn it with excel lie a report