This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<fields> | |
<fullName>Picklist__c</fullName> | |
<externalId>false</externalId> | |
<label>Picklist</label> | |
<length>40</length> | |
<required>true</required> | |
<type>Text</type> | |
<unique>false</unique> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Database.DMLOptions dml = new Database.DMLOptions(); | |
dml.DuplicateRuleHeader.AllowSave = true; | |
Account acc = [Select Name From Account Where Name = 'TAO京都' limit 1]; | |
Contact newContact = new Contact(AccountId = acc.Id, | |
FirstName = 'ABC', | |
LastName = 'TAO'); | |
Database.SaveResult sr = Database.insert(newContact, dml); | |
// 実際にはエラーが発生して登録できなかった... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual class TrgHandler { | |
//------------------------------------------------------------------------------------------------ | |
// トリガイベントに応じたインターフェースの定義 | |
//------------------------------------------------------------------------------------------------ | |
public virtual interface ObserverTrg { | |
} | |
public interface ObserverTrgBeforeInsert extends ObserverTrg { | |
List<SObject> onBeforeInsert(List<SObject> newObjects); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class TrgHandlerAccount extends TrgHandler { | |
private static Boolean InProcess = false; | |
public TrgHandlerAccount(boolean pIsExecuting, Integer pSize){ | |
super(pIsExecuting, pSize); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger AccountTrigger on Account (before insert, before update) { | |
TrgHandlerAccount handler = new TrgHandlerAccount(Trigger.isExecuting, Trigger.size); | |
// トリガハンドラの拡張 | |
// -> カスタム設定などに、Apexクラス名を追加しておいて動的に設定できるようにするのもアリ... | |
// Type t = Type.forName('ApexClass Name'); | |
// handler.addObserver('before insert, before update', (ObserverTrg)t.newInstance()); | |
handler.addObserver('before insert,before update', new TrgHandlerAccount_Validation()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger ContactTrigger on Contact (after insert, after update) { | |
TrgHandler_Contact handler = new TrgHandler_Contact(Trigger.isExecuting, Trigger.size); | |
if(Trigger.isAfter && Trigger.isInsert){ | |
handler.OnAfterInsert(Trigger.newMap); | |
} | |
if(Trigger.isAfter && Trigger.isUpdate){ | |
handler.OnAfterUpdate(Trigger.newMap); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class TrgHandler_Contact { | |
private Boolean IsExecuting = false; | |
private Integer BatchSize = 0; | |
public TrgHandler_Contact(boolean param_IsExecuting, Integer param_Size){ | |
this.IsExecuting = param_IsExecuting; | |
this.BatchSize = param_Size; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class integratewithheroku { | |
public static Boolean IsProcessing = false; | |
@future (callout=true) | |
public static void callout(Set<Id> contactIds){ | |
if(contactIds.size() > 10){ | |
throw new IntegrateWithHerokuException('Too Many Contact.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="Con_Translate"> | |
<apex:pageMessage summary="Translating.... Please Wait." severity="info" strength="3" /> | |
<script type="text/javascript"> | |
var doTranslate = function(token){ | |
var params = {'token': token, 'text': '山吹色の波紋疾走!'}; | |
Con_Translate.doTranslateText(params, function(res,event){ | |
console.log(res); | |
}, {escape:true}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global with sharing class Con_Translate { | |
global Con_Translate(ApexPages.standardController stdCon){} | |
global Con_Translate(){} | |
/** | |
* 翻訳用APIを利用する | |
*/ | |
@RemoteAction |
NewerOlder