Skip to content

Instantly share code, notes, and snippets.

View tyoshikawa1106's full-sized avatar
🇯🇵
TOKYO

Taiki Yoshikawa tyoshikawa1106

🇯🇵
TOKYO
View GitHub Profile
@tyoshikawa1106
tyoshikawa1106 / 01_SearchPage.page
Last active December 18, 2015 20:39
VisualforceページStyleタグ外出しサンプル
<apex:page standardController="Account" showHeader="true" sidebar="false" id="page">
<apex:include pageName="SearchCss"/>
<apex:form id="form">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value=" 検索 " />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:panelGrid columns="2">
<apex:outputText value="{!$ObjectType.Account.fields.Name.Label}" styleClass="labelCol" />
@tyoshikawa1106
tyoshikawa1106 / Sample2Controller.cls
Created June 23, 2013 02:42
Exceptionとテストクラス
public with sharing class Sample2Controller {
public Boolean isException {get; set;}
public Sample2Controller() {
try {
Id i = 'xxx';
} catch (Exception e) {
this.isException = true;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Exception Error'));
global with sharing class ChildRemoteController {
@RemoteAction
global static String sayHello(String helloTo) {
return 'Hello ' + helloTo + ' from the Grandparent.';
}
@RemoteAction
global static List<sObject> queryData(String query){
return Database.query(query);
}
@tyoshikawa1106
tyoshikawa1106 / DataUtilTest.cls
Last active December 19, 2015 08:39
Test Method loadData Sample
@isTest
private class DataUtilTest {
static testMethod void myUnitTest() {
List<sObject> accountsList = Test.loadData(Account.sObjectType, 'AccountsTest');
System.assertEquals(accountsList.size(), 1);
List<Account> accounts = [select Id,Name,Type,AccountNumber,Rating,Site
from Account where Id IN: accountsList limit 200];
<apex:page controller="AutoRubySampleController" id="page">
<apex:includeScript value="{!$Resource.KanaTextExtension}"/>
<script>
kntxtext.target.push([ 'name1', 'ruby1', kntxtext.constant.letterType.kana, kntxtext.constant.insertType.auto ]);
</script>
<apex:form id="form">
<apex:pageBlock title="フリガナ自動挿入" id="block">
<apex:pageBlockSection columns="1" id="section">
<apex:pageBlockSectionItem id="inutSectionItem">
<apex:outputText value="名前" id="inputLabel"/>
@tyoshikawa1106
tyoshikawa1106 / SelectRadioRequiredSample.page
Created July 8, 2013 08:58
SelectRadioの必須表示サンプル
<apex:page controller="SelectRadioController" id="page">
<apex:form id="form">
<apex:pageMessages />
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Click!!" action="{!doClick}" rerender="form"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputText value="Radio" />
<apex:page controller="FutureAnnotationDemoController" id="page">
<apex:form id="form">
<apex:commandButton value="Click!!" action="{!doClick}" reRender="form" />
</apex:form>
</apex:page>
@tyoshikawa1106
tyoshikawa1106 / UpdateObjectTrigger.trigger
Created July 18, 2013 13:42
項目自動更新時のトリガー実行検証
trigger UpdateObjectTrigger on UpdateObject__c (before update, after update) {
if (Trigger.isBefore) {
System.debug('isBefore');
} else if (Trigger.isAfter) {
System.debug('isAfter');
}
}
@tyoshikawa1106
tyoshikawa1106 / OutputTextAndCustomLabel
Created July 22, 2013 11:55
outputTextとカスタム表示ラベル
<apex:page id="page">
<apex:form id="form">
<apex:outputText value="{!$Label.Message}" escape="false" />
</apex:form>
</apex:page>
<apex:page controller="ComparableDemoController" showHeader="true" sidebar="false" id="page">
<apex:form id="form">
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!comparableAccounts}" var="item">
<apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}">
<apex:outputText value="{!item.account.Name}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Account.Fields.AccountNumber.Label}">
<apex:outputText value="{!item.account.AccountNumber}" />