Skip to content

Instantly share code, notes, and snippets.

View shunkosa's full-sized avatar
🌩️
Beyond the cloud

Shun Kosaka shunkosa

🌩️
Beyond the cloud
View GitHub Profile
@shunkosa
shunkosa / customlabel_dependencies.py
Last active February 13, 2023 15:15
A simple python script to export a csv file with metadata component dependencies on Custom Labels in Salesforce
#!/usr/bin/env python
# coding: utf-8
import sys
import os
import datetime
import csv
from simple_salesforce import Salesforce
def retrieve():
"""Retrieve metadata component dependency with custom labels in the target salesforce org

お題1: 3値の比較

  • 開発者コンソールの匿名実行ウィンドウ(Debug -> Open Execute Anonymous Window) にコピーペーストします。Open Logにチェックを入れて実行しましょう。
  • ログが開いた後、Debug Only にチェックを入れると、最大値が表示されるはずです。
Integer a,b,c,max;
a = 5;
b = 10;
c = 7;
@shunkosa
shunkosa / 20211104 SJAG & DG コラボ Apexへの道2.md
Last active November 4, 2021 08:00
20211104 SJAG & DG コラボ Apexへの道2

お題1

  • 3値を比較するApexプログラム
  • 開発者コンソールの匿名実行ウィンドウ(Debug -> Open Execute Anonymous Window) にコピーペーストします。Open Logにチェックを入れて実行しましょう。
  • ログが開いた後、Debug Only にチェックを入れると、最大値が表示されるはずです。
Integer a,b,c,max;
a = 5;
b = 10;
c = 7;
@shunkosa
shunkosa / LightningBlue.page
Created June 22, 2021 00:55
Visualforce page with Lightning blue background
<apex:page showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false" standardStylesheets="false" docType="html-5.0">
<html>
<head>
<apex:slds />
<style type="text/css">
body {
margin: 0;
background-color: rgba(176, 196, 223, 1.0);
}
@shunkosa
shunkosa / ExampleUtilityItemCloseAction
Last active May 22, 2020 07:48
Lightning フローのアクションでユーティリティアイテムを閉じる / Close Utility Item in Lightning Flow Action
<!--ExampleUtilityItemCloseAction.cmp-->
<aura:component implements="force:lightningQuickAction,lightning:availableForFlowActions,lightning:utilityItem">
<lightning:utilityBarAPI aura:id="utilitybar" />
</aura:component>
<!--ExampleUtilityItemCloseActionController.js-->
({
invoke : function(component, event, helper) {
var utilityAPI = component.find("utilitybar");
utilityAPI.getEnclosingUtilityId()
<decisions>
<processMetadataValues>
<name>index</name>
<value>
<numberValue>0.0</numberValue>
</value>
</processMetadataValues>
<name>myDecision</name>
<label>myDecision</label>
<locationX>50</locationX>
require 'json'
require 'csv'
dictionary = {}
# List all the english labels
Dir.glob('**/package.nls.json') do |json_path|
package_name = json_path.sub(/packages\/salesforcedx-vscode-/,'').sub(/\/package.nls.json/,'')
File.open(json_path) do |data|
json_hash = JSON.load(data)
json_hash.each do |key, value|
@shunkosa
shunkosa / TERAKOYA-20191031.md
Last active November 1, 2019 05:26
TERAKOYAFORCE EAST 2019/10/31 Advanced数式&入力規則の解答例です

TERAKOYAFORCE Advanced数式&入力規則

Q1 - 商談フェーズの逆戻りを制限する

Trailhead PlaygroundやDeveloper Edition環境での例は以下の通りですが、任意の選択リスト項目で同様の考え方が適用できます。

CASE(PRIORVALUE(StageName),
  'Prospecting',1,
  'Qualification',2,
  'Needs Analysis',3,
  'Value Proposition',4,
#.github/workflows/main.yml
name: Scratch org for review
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
if: github.event.action == 'opened' || github.event.action == 'synchronize'
@shunkosa
shunkosa / prohibit-attachments-on-chatter.cls
Last active July 30, 2019 08:19
Chatterへのファイル添付を禁止するApexトリガ
//Chatter投稿(FeedItem)のトリガ
trigger FeedItemTrigger on FeedItem (before insert) {
FeedItemTriggerHandler.handleTrigger(Trigger.new, Trigger.old, Trigger.operationType);
}
//Chatter投稿に添付ファイルがある場合にエラーを表示するApexクラス
public class FeedItemTriggerHandler {
public static void handleTrigger(List<FeedItem> newRecords, List<FeedItem> oldRecords, System.TriggerOperation triggerEvent){
switch on triggerEvent{
when BEFORE_INSERT {