Skip to content

Instantly share code, notes, and snippets.

View atskimura's full-sized avatar

atskimura

  • co-meeting, Inc.
  • Tokyo
View GitHub Profile
- var: snowfakery_locale
value: ja_JP
- object: Account
count: 2
fields:
Name:
fake: company
Type:
random_choice:
- Prospect
@atskimura
atskimura / AccountTriggerByChatGPT.trigger
Created December 4, 2022 08:40
ChatGPTが生成した取引先の請求先住所に緯度経度を保存するApexトリガー
// トリガーを作成する対象のオブジェクトとフィールド
trigger UpdateGeocode on Account (after update) {
// トリガーが実行される条件を指定する
for (Account a : Trigger.new) {
if (a.BillingStreet != Trigger.oldMap.get(a.Id).BillingStreet ||
a.BillingCity != Trigger.oldMap.get(a.Id).BillingCity ||
a.BillingState != Trigger.oldMap.get(a.Id).BillingState ||
a.BillingCountry != Trigger.oldMap.get(a.Id).BillingCountry ||
a.BillingPostalCode != Trigger.oldMap.get(a.Id).BillingPostalCode) {
// Google Geocoding API のエンドポイント URL
@atskimura
atskimura / project-scratch-def.json
Created May 19, 2020 06:52
Person Account Scratch Org Definition
{
"orgName": "Person Account Company",
"edition": "Enterprise",
"hasSampleData": true,
"features": ["PersonAccounts"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
}
}
public class SecureDML {
public class SecureDMLException extends Exception {}
/**
* CRUD/FLSチェックを行うinsert
*/
public static sObject[] secureInsert(sObject[] records) {
return secureDML(records, AccessType.CREATABLE);
}
@atskimura
atskimura / notifyApexErrorSample.js
Last active March 1, 2020 15:22
LWCのApexエラー処理
import { LightningElement, wire, track } from 'lwc';
import getContacts from '@salesforce/apex/NotifyApexErrorSampleController.getContacts'
import { notifyApexError } from 'c/util';
export default class NotifyApexErrorSample extends LightningElement {
@track contacts;
@wire(getContacts)
wiredContacts({ error, data }) {
if (data) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>three-vrm example</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<aura:component >
<p>This is a lightning component in a managed package.</p>
</aura:component>
<aura:component implements="force:appHostable">
<div>
<div aura:id="draggable" draggable="true" class="draggable"></div>
<div aura:id="draggable" draggable="true" class="draggable"></div>
</div>
</aura:component>