This file contains hidden or 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
| //This is a sample code for AccountTriggerHandler | |
| public class AccountTriggerHandler extends TriggerHandler{ | |
| public override void beforeInsert(){ | |
| System.debug( 'AccountTriggerHandler beforeInsert Start' ); | |
| System.debug( 'Trigger.isExecuting : ' + isExecuting ); | |
| System.debug( 'Trigger.isInsert : ' + isInsert ); | |
| System.debug( 'Trigger.isUpdate : ' + isUpdate ); | |
| System.debug( 'Trigger.isDelete : ' + isDelete ); |
This file contains hidden or 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 delete, before insert, before update, | |
| after delete, after insert, after update,after Undelete) { | |
| TriggerHandlerManager handlerManager = new TriggerHandlerManager(); | |
| handlerManager.add( new AccountTriggerHandler() ); | |
| handlerManager.run(); | |
| } |
This file contains hidden or 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
| TriggerHandlerManager.stop( 'CustomObject__c' ); | |
| TriggerHandlerManager.resume( 'CustomObject__c' ); |
This file contains hidden or 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
| TriggerHandlerManager.stop( 'AccountTriggerHandler' ); | |
| TriggerHandlerManager.resume( 'AccountTriggerHandler' ); |
This file contains hidden or 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 class SObjectCreation { | |
| public static sObject createObject( String typeName ) { | |
| Schema.SObjectType targetType = Schema.getGlobalDescribe().get( typeName ); | |
| if ( targetType == null ) { | |
| // throw an exception | |
| } | |
| // Instantiate an sObject with the type passed in as an argument | |
| // at run time. | |
| return targetType.newSObject(); |
This file contains hidden or 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
| Account a = ( Account )SObjectCreation.createObject( Account.sObjectType ); |
This file contains hidden or 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 class WS_Util { | |
| //Normal Status Code | |
| private static String API_STATUS_NORMAL = '200'; | |
| //Error Status Code | |
| private static String API_STATUS_ERROR = '400'; | |
| /** | |
| * Normal JSON Response | |
| */ |
This file contains hidden or 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 class WS_ZipUtil { | |
| /** | |
| * Receive Attachments info from Attachment ParentId | |
| */ | |
| webService static String getAttachmentByParentId( String sfdcId ){ | |
| if( String.isEmpty( sfdcId ) ) return WS_Util.errorJson('Parameter sfdcId is required.'); | |
| List<Attachment> attachmentList = [SELECT Id, Name, Body, ContentType FROM Attachment WHERE ParentId = :sfdcId]; |
This file contains hidden or 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 standardController="Account"> | |
| <apex:includeScript value="/soap/ajax/25.0/connection.js"/> | |
| <apex:includeScript value="/soap/ajax/25.0/apex.js"/> | |
| <apex:includeScript value="{!URLFOR($Resource.jQuery)}"/> | |
| <apex:includeScript value="{!URLFOR($Resource.JSZip)}"/> | |
| <script type="text/javascript"> | |
| //Download all Attachments from sobject id | |
| function downloadFromObjectId( btn ){ |
This file contains hidden or 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
| "mm_workspace" : "/var/workspace", |