2018年8月23日 星期四
Salesforce Attachment 清單
工具:Salesforce Attachment Manager
https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016cm0EAA
另解
產生DOC再下載
參考:https://success.salesforce.com/answers?id=90630000000gzj6AAA
2017年3月22日 星期三
Apex VF 上使用output check
因為salesforce沒有outputcheck元件所以使用以下方式達到:
<apex:inputCheckbox value="{!@variable}" disabled="true"/>
<apex:inputCheckbox value="{!@variable}" disabled="true"/>
2017年3月17日 星期五
How to create Date as input with Calendar in visualforce page
How to create Date as input with Calendar in visualforce page
-------- Vf page-------------
<apex:page controller="inputdate" >
<script>
function DynamicDatePicker(d_id)
{
DatePicker.pickDate(false,d_id.id,false);
}
</script>
<apex:form >
<apex:inputText id="time" value="{!inputdate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="20" disabled="false" style="width:150px;"/>
<apex:commandButton action="{!testdate}" value="Save" />
</apex:form>
</apex:page>
--------------------- Apex Controller --------------------
public class inputdate
{
public date inputdate{get;set;}
public void testdate()
{
system.debug('@@@@@@@@@@@@@@'+inputdate);
}
}
2017年3月14日 星期二
於Visualforce Page中轉換編碼(跳行)
於Visualforce Page中轉換編碼(跳行)
var des = "{!JSENCODE(account.Description)}";
if(des != "") alert(des);
var des = "{!JSENCODE(account.Description)}";
if(des != "") alert(des);
2017年2月24日 星期五
Get role hierarchy in SOQL query
Get role hierarchy in SOQL query
參考網址:https://developer.salesforce.com/forums/?id=906F0000000DCTFIA4
01 | private static Set<ID> getAllSubRoleIds(Set<ID> roleIds) { |
02 |
03 | Set<ID> currentRoleIds = new Set<ID>(); |
04 |
05 | // get all of the roles underneath the passed roles |
06 | for(UserRole userRole :[select Id from UserRole where ParentRoleId |
07 | IN :roleIds AND ParentRoleID != null]) { |
08 | currentRoleIds.add(userRole.Id); |
09 | } |
10 |
11 | // go fetch some more rolls! |
12 | if(currentRoleIds.size() > 0) { |
13 | currentRoleIds.addAll(getAllSubRoleIds(currentRoleIds)); |
14 | } |
15 |
16 | return currentRoleIds; |
17 | } |
參考網址:https://developer.salesforce.com/forums/?id=906F0000000DCTFIA4
訂閱:
文章 (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