プロセスビルダーでToDoの「期日」項目表示
Salesforceの画面では「ToDo」で「期日」と表示される項目が、プロセスビルダーでは「期日のみ」と表示されてしまいます。
これは、SalesforceのAPIがこの項目(ActivityDate)に関しては、項目の表示ラベルと異なる値を返すことが原因です。
kinkun's blog
プロセスビルダーでToDoの「期日」項目表示
Salesforceの画面では「ToDo」で「期日」と表示される項目が、プロセスビルダーでは「期日のみ」と表示されてしまいます。
これは、SalesforceのAPIがこの項目(ActivityDate)に関しては、項目の表示ラベルと異なる値を返すことが原因です。
オブジェクトのレコードタイプ名からレコードタイプ表示ラベル取得例を紹介します。
String RecordTypeDevName = 'testDevName';
String objName = 'testObject__c';
List<RecordType> recordTypeList = [
SELECT Id
, Name
FROM RecordType
WHERE SobjectType = : objName
AND DeveloperName = : RecordTypeDevName
];
for(RecordType rtobj : recordTypeList){
system.debug('rtobj.Name:'+rtobj.Name);
}
オブジェクトAPI参照名からオブジェクト表示ラベル取得例を紹介します。
String searchObjName = 'Account';
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
for (String sKey : gd.keySet()) {
Schema.DescribeSObjectResult targetObject = gd.get(sKey).getDescribe();
if(targetObject.getName() == searchObjName){
System.debug('targetObject.getLabel()----->targetObject.getName()::::::'+targetObject.getLabel()+'----->'+targetObject.getName());
}
}
オブジェクトAPI参照名からオブジェクト表示ラベル取得例を紹介します。
String searchObjLabelName = '取引先';
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
for (String sKey : gd.keySet()) {
Schema.DescribeSObjectResult targetObject = gd.get(sKey).getDescribe();
if(targetObject.getLabel() == searchObjLabelName){
System.debug('targetObject.getLabel()----->targetObject.getName()::::::'+targetObject.getLabel()+'----->'+targetObject.getName());
}
}
オブジェクトのレコードタイプIDからレコードタイプ名取得例を紹介します。
List<RecordType> recordTypeList = [
SELECT Id
, Name
FROM RecordType
WHERE SobjectType = 'testObj__c'
AND Id = '012211111111111111'
];
for(RecordType rtobj : recordTypeList){
system.debug('rtobj.Name:'+rtobj.Name);
}
または、以下の例もあります。
String searchObjName = 'testObj__c';
String searchRecordTypeId = '012211111111111111';
List<RecordType> recordTypeList = [
SELECT Id
, Name
FROM RecordType
WHERE SobjectType = : searchObjName
AND Id = : searchRecordTypeId
];
for(RecordType rtobj : recordTypeList){
system.debug('rtobj.Name:'+rtobj.Name);
}
テストクラス実行時、「Failed to run tests synchronously.: Your query request was running for too long.」エラーの対応
Summary
Test classes failing with QUERY_TIMEOUT Failed to run tests synchronously when running in synchronous mode
Error Message:
“QUERY_TIMEOUT Failed to run tests synchronously: Your query request was running for too long”
Workaround
As a workaround, please try to run the test class in asynchronous mode.
lightning-record-form を使用して取引先責任者を作成例を紹介します。
contactCreator.html
<template>
<lightning-card>
<lightning-record-form
object-api-name={objectApiName}
fields={fields}
onsuccess={handleSuccess}>
</lightning-record-form>
</lightning-card>
</template>
contactCreator.js
import { LightningElement } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import CONTACT_OBJECT from '@salesforce/schema/Contact';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
export default class ContactCreator extends LightningElement {
objectApiName = CONTACT_OBJECT;
fields = [FIRSTNAME_FIELD, LASTNAME_FIELD, EMAIL_FIELD];
handleSuccess(event) {
const toastEvent = new ShowToastEvent({
title: "Contact created",
message: "Record ID: " + event.detail.id,
variant: "success"
});
this.dispatchEvent(toastEvent);
}
}
contactCreator.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>51.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
</targets>
</LightningComponentBundle>
設定 をクリックして [設定] を選択します。
[クイック検索] ボックスに「Lightning アプリケーションビルダー」(Lightning App Builder)と入力し、[Lightning アプリケーションビルダー] を選択します。
Lightning ページを作成します。
[新規] (New)をクリックします。
[アプリケーションページ] (App Page)を選択し、[次へ] をクリックします。
[表示ラベル] に「Working with Data」(データの操作) と入力し、[次へ] をクリックします。
レイアウトで [ヘッダーと左サイドバー] (Header and Left Sidebar)を選択します。
[完了] (Finish)をクリックします。
contactCreator コンポーネントをページサイドバーにドラッグします。
ページを保存(Save)します。
ページを有効化します。デフォルトのアプリケーション名 (Working with Data) のままで [保存] (Save)をクリックします。
ページをナビゲーションメニューに追加するように要求されたら、[完了] (Finish)をクリックします。
新しいページを開きます。アプリケーションランチャーの検索で「work」と入力し、[Working with Data (データの操作)] を選択します。
データを登録します。
First name: Lisa
Last name: Jones
Email: ljones@developer.com
レコードタイプ取得方法について紹介します。
SOQLから取得する方法
List<RecordType> rtList = [
Select Id, Name, DeveloperName
From RecordType
WHERE SobjectType='Account'];
for (RecordType rt : rtList) {
system.debug('rt.Id:'+rt.Id); // レコードタイプID
system.debug('rt.Name:'+rt.Name); // レコードタイプラベル名
system.debug('rt.DeveloperName:'+rt.DeveloperName); // レコードタイプAPI名
}
「Failed to load data Log from Salesforce.com: Salesforce automatically deletes system logs 24 hours after they’re generated. If the log you had open was less than 24 hours old, someone deleted it. To save logs, select File > Download Log.」エラー対応方法例を紹介します。
エラー

解決法の一つの例
DeveloperConsoleFix.page作成
<apex:page docType="html-5.0" id="thepage">
<script src="//cdnjs.cloudflare.com/ajax/libs/jsforce/1.7.0/jsforce.min.js"></script>
<p>
Yes, "Delete my IDEWorkspace" sounds a little scary. But that's actually what this script will do.
The developer console state is maintained in a record in table IDEWorkspace.
When that record is deleted, there is no state. If the dev
console decides to save something, it notices that and creates a new record.
</p>
<p>
This is not really documented anywhere. You can learn a little bit by reading
the Salesforce help article <a href="https://help.salesforce.com/articleView?id=000205964&language=en_US&type=1">Developer Console menus not working</a>
The API we are using is the
<a href="https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/">Tooling API</a>.
The documentation merely notes that "The following
Tooling API objects are used internally by the Developer Console."
</p>
<apex:form id="theform">
<apex:pageblock id="thepageblock">
<apex:pageblockButtons location="top" id="buttons">
<apex:commandButton value="Delete my IDEWorkpace"
onclick="deleteIDEWorkspace()"
disabled="True"
id="deletebutton"
/>
</apex:pageblockButtons>
<apex:pageBlockSection id="section">
<apex:pageblocksectionitem id="item1">
<apex:outputlabel value="IDEWorkspace ID:" styleclass="bold"/>
<apex:outputtext value="not found" id="IdDisplay" />
</apex:pageblocksectionitem>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
<apex:outputPanel id="emptypanel">
</apex:outputPanel>
<script>
var conn = new jsforce.Connection({ accessToken: '{!$Api.Session_Id}' });
var workspaceId;
var deleted = false;
var button = document.getElementById('{!$Component.thepage.theform.thepageblock.buttons.deletebutton}');
var notFoundMessage = 'No IDEWorkspace found for your user';
var idDisplay = document.getElementById('{!$Component.thepage.theform.thepageblock.section.item1.IdDisplay}');
conn.tooling.query("select id, name, createdbyid from ideworkspace where createdbyid = '{!$User.Id}'",
function(err, result) {
if (err) { alert(err); }
else if (result.totalSize > 1) {
alert('Query returned multiple IDEWorkspaces ' + JSON.stringify(result));
}
else if (result.totalSize < 1) {
idDisplay.innerHTML = notFoundMessage;
}
else {
// exactly one IDEWorkspace found for this user
workspaceId = result.records[0].Id;
console.log(workspaceId);
button.className = "btn";
button.disabled = false;
document.getElementById('{!$Component.thepage.theform.thepageblock.section.item1.IdDisplay}').innerHTML = workspaceId;
}
});
function deleteIDEWorkspace() {
conn.tooling.query("select id, name, createdbyid from ideworkspace where createdbyid = '{!$User.Id}'",
function(err, result) {
if (err) { alert(err); }
else if (result.totalSize > 1) {alert('Query returned multiple IDEWorkspaces ' + JSON.stringify(result));}
else if (result.totalSize < 1) {alert('Could not determine Id of your IDEWorkspace');}
else {
console.log(workspaceId);
console.log("deleting...");
conn.tooling.sobject('IDEWorkspace').delete(workspaceId, function(err, ret) {
if (err || !ret.success) { return console.error(err, ret); }
alert('Deleted IDEWorkspace Successfully : ' + ret.id);
button.className = "btnDisabled";
button.disabled = false;
});
}
});
}
</script>
</apex:page>
参考URL:https://github.com/bolaurent/salesforce-developer-console-fix/blob/master/DeveloperConsoleFix.page
上記のVisualforceページ表示する。
https://{インスタンス}/apex/DeveloperConsoleFix

「Delete my IDEWorkspace」ボタン押下する。
ボタン押下後いかのように表示されます。

もちろん、開発者コンソール押下したら、今回のエラーは出ないはずです。