多次元配列でサイズ取得
let userData = [
['a', 2, 'Tokyo'],
['b', 3, 'Fukuoka'],
['c', 4, 'Sendai']
];
let user1 = userData[0];
console.log(userData.length);
console.log(user1[0].length);
結果
3
3
kinkun's blog
多次元配列でサイズ取得
let userData = [
['a', 2, 'Tokyo'],
['b', 3, 'Fukuoka'],
['c', 4, 'Sendai']
];
let user1 = userData[0];
console.log(userData.length);
console.log(user1[0].length);
結果
3
3
多次元配列で該当要素参照
let userData = [
['a', 2, 'Tokyo'],
['b', 3, 'Fukuoka'],
['c', 4, 'Sendai']
];
let user1 = userData[0];
console.log(user1[0]);
console.log(user1[1]);
console.log(user1[2]);
結果
a
2
Tokyo
Apexで日付データのyyyy-mm-ddフォーマット変換
Date dSample = Date.newInstance(2022, 7, 21);
String.valueOf(dSample); // 2022-07-21
日付日時データをtimestampへ変換
let timestampSample = new Date('1995-12-17T03:24:00')
コレクションまたはサブコレクションが存在するかどうかを確認
subCollection2存在確認
const db = firebase.firestore();
const collection1 = db.collection('collection1');
var doc = collection1
.doc("docId1")
.collection('subCollection1')
.doc("subDocId1")
.collection('subCollection2')
.get()
.then(snapshot => {
console.log(snapshot.docs.length);
if(snapshot.docs.length > 0){
console.log(snapshot.docs.length);
}
else{
console.log(snapshot.docs.length);
}
});
PDFを作成し、Salesforceメールテンプレートに添付する方法
How to Attach a Dynamic PDF to a Salesforce Messaging Email Template
https://www.codeproject.com/Tips/1129916/How-to-Attach-a-Dynamic-PDF-to-a-Salesforce-Messag
PDFファイルを作成して、Salesforceメールテンプレートに添付
Visualforceメールテンプレ―ド:
<messaging:emailTemplate subject="test: {!relatedTo.name}" recipientType="Contact" relatedToType="Opportunity">
<messaging:plainTextEmailBody >
添付送付させていただきます。
ご確認お願いいたします。
</messaging:plainTextEmailBody>
<messaging:htmlEmailBody >
<html>
<body>
<p>添付送付させていただきます。</p>
<p>ご確認お願いいたします。</p>
</body>
</html>
</messaging:htmlEmailBody>
<messaging:attachment renderAs="PDF" filename="Invoice.pdf">
<c:OppAttachmentComponent opportunityId="{!relatedTo.Id}" opportunity="{!relatedTo}"/>
</messaging:attachment>
</messaging:emailTemplate>
Component : OppAttachmentComponen
<apex:component controller="OppAttachmentComponentController" access="global" >
<apex:attribute name="opportunityId" description="OpportunityId" assignTo="{!OpportunityId}" type="Id" />
test
{!opportunity.Name}
</apex:component>
commponent controller : OppAttachmentComponentController
global class OppAttachmentComponentController {
global String OpportunityId{
get;
set {
UpdateContents2(value);
}
}
public void UpdateContents2(String OpportunityId) {
if (OpportunityId != null) {
List<Opportunity> oppList = [SELECT Id FROM Opportunity WHERE Id =:OpportunityId];
}
}
}