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 AccountAddressTrigger on Account (before insert, before update) { | |
Pattern p = Pattern.compile('^\\s*〒?\\s*(\\d{3}\\-\\d{4})?\\s*(東京都|北海道|(?:京都|大阪)府|.{2,3}県)?\\s*(.[^市区町村]*[市区群町村])(.*\\s*.*)$'); | |
for (Account acc : Trigger.new) { | |
if (Trigger.isUpdate) { | |
Account oldAcc = Trigger.oldMap.get(acc.Id); | |
if (oldAcc.Address__c == acc.Address__c) continue; | |
} | |
if (acc.Address__c == null) continue; | |
Matcher m = p.matcher(acc.Address__c); | |
if (m.find()) { |
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
javascript:(function(d){d.body.appendChild(d.createElement('script')).src='/soap/ajax/18.0/connection.js';setTimeout(function(c,u,ui){c=sforce.connection;c.sessionId=d.cookie.match(/(^|;\s*)sid=(.+?);/)[2];u=new sforce.SObject('User');ui=c.getUserInfo();u.Id=ui.userId;u.LanguageLocaleKey=/ja/.test(ui.userLanguage)?'en_US':'ja';c.update([u]);location.reload()},1000)})(document) |
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
javascript:(function(d){__sfdcSessionId=d.cookie.match(/(^|;\s*)sid=(.+?);/)[2];d.body.appendChild(d.createElement('script')).src='/soap/ajax/18.0/connection.js';setTimeout("sforce.debug.open()",2000)})(document) |
NewerOlder