Skip to content

Instantly share code, notes, and snippets.

View sfdcfanboy's full-sized avatar

sfdcFanBoy sfdcfanboy

View GitHub Profile
<apex:page controller="AccountMultipleSearchWithPagenationCLS" action="{!searchAcc}" >
<script type="text/javascript">
window.onload=function() {
// document.getElementById("{!$Component.thePb.thepbs.accName}").focus();
}
</script>
<apex:form >
<apex:pageBlock id="thePb" title="Account Details To Search">
<apex:pageblockSection id="thepbs">
<apex:inputField value="{!acc.Created_From_Date__c}" />
public with sharing class AccountMultipleSearchWithPagenationCLS {
public Account acc{get;set;}
public List<Account> accountList {get;set;}
// create a list of strings to hold the conditions
List<string> conditions = new List<string>();
private integer totalRecs = 0;
private integer OffsetSize = 0;
private integer LimitSize= 10;
public AccountMultipleSearchWithPagenationCLS(){
<messaging:emailTemplate subject="Opportunities to verify" recipientType="Contact" relatedToType="Account">
<messaging:htmlEmailBody >
Good Morning! Here are the opporunities that needs verification. <br/><br/>
<c:OpportunitiesToVerify accountIdValue="{!relatedTo.Id}" />
ref: {!relatedTo.id}
</messaging:htmlEmailBody>
<apex:component access="global" controller="OppsWithMatches">
<apex:attribute name="accountIdValue" type="String" description="This is the Id of the account" assignTo="{!accountId}" access="global" />
<table class="table">
<thead>
<tr>
<th>Opportunity Name</th>
<th>Opportunity Description</th>
<th>Opportunity Amount</th>
// Query the accounts to lock
Account[] accts = [SELECT Id from Account WHERE Name LIKE 'Acme%'];
// Lock the accounts
Approval.LockResult[] lrList = Approval.lock(accts, false);
// Iterate through each returned result
for(Approval.LockResult lr : lrList) {
if (lr.isSuccess()) {
// Operation was successful, so get the ID of the record that was processed
System.debug('Successfully locked account with ID: ' + lr.getId());
trigger OppTrigger on Opportunity (after insert, before update) {
Map<String, Id> typeMap = New Map<ID,RecordType>();
for(RecordType rt: [Select ID, DeveloperName From RecordType Where sObjectType = 'Opportunity']) {
typeMap.put(rt.DeveloperName, rt.id);
}
for (Opportunity opp : trigger.new) {
// And the Agreement Category on the record = TEST
if (opp.Stage__c == 'Negotiation/Review') {
@sfdcfanboy
sfdcfanboy / CopyTypeToAccountType
Created July 19, 2017 08:57
Run in developer console anonymous code
List<Account> accList = [SELECT id,type,customer_type__c FROM account WHERE type!=null LIMIT 200];
for(account a:accList){
a.customer_type__c = a.type;
}
update accList;
public class ApprovalProcessor {
webservice void submitAndProcessApprovalRequest() {
// Create an approval request for the account
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(a.id);
global with sharing class OppsWithMatches{
global List<Opportunity> Opps{get;set;}
global String accountId{get;set;}
global account account{
get {
Account = [Select Id, name from Account where id =: accountId];
return account; }
set;
}
//product1
Product2 p = new Product2();
p.Name = 'Test Product';
p.Description = 'Test desc';
p.IsActive = true;
insert p;
//standard price book entry for Product p
PricebookEntry pbe1 = new PricebookEntry();
pbe1.Pricebook2Id = Test.getStandardPricebookId();