• Steven Meller
  • NEWBIE
  • 40 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
How can I remove logic from the following trigger into an apex class?
trigger AssignAccNumber on Opportunity(before insert,before update){
    
    List<Id> accIds = new List<Id>();
    
    for(Opportunity opp:trigger.new){
        
        if(opp.AccountId!=null){
            
            accIds.add(opp.AccountId);
        }
    }
    
    Map<Id,Account> accMap = new Map<Id,Account>([SELECT id,Area__c,AccountNumber,Type FROM Account WHERE id in:accIds]);
    Account a = [SELECT AccountNumber FROM Account WHERE AccountNumber != null AND Type='Prospect' AND Area__c='East' ORDER BY AccountNumber DESC LIMIT 1];
    
    for(Opportunity opp :Trigger.new){
     Account accs = accMap.get(opp.AccountId);       
        
	if(!accMap.IsEmpty()){
            
            if(opp.Probability == 95 && accs.AccountNumber == null){
                
                if(accs.LC_Market__c == 'Americas' && accs.Type == 'Prospect'){
                    
                    accs.AccountNumber = String.valueOf(Integer.valueOf(a.AccountNumber)+1);
                }            
            }
            update accMap.values();
        }
    }            
}

 
This task, creating a Static Resource from:
Download the current version of the jQuery Mobile JavaScript library, currently jQuery Mobile 1.4.4, in the ZIP format.
The newest version, 1.4.5 is 7MB and of course does not upload.
 
Getting this error  [Error] Error: Compile Error: unexpected token: 'ApexPages.StandardController' at line 3 column 37
I'm trying to add the ApexPages so I can add this VF page via page layout editor.

Thanks,  Paul

public with sharing class CapturePSignatureController {

public CapturePSidnature Controller {ApexPages.StandardController} { 
 
 @RemoteAction
 global static String savePSignature(String imageUrl, String accountId) {
 
  
  try {
   Attachment accSign = new Attachment();
   accSign.ParentID = accountId;
   accSign.Body = EncodingUtil.base64Decode(imageUrl);
   accSign.contentType = 'image/png';
   accSign.Name = 'Patient Signature Image';
   accSign.OwnerId = UserInfo.getUserId();
   insert accSign;
   
   return 'success';
   
  }catch(Exception e){
   system.debug('---------- ' + e.getMessage());
   return JSON.serialize(e.getMessage());
  }
  return null; 
 }

}
 
How can I remove logic from the following trigger into an apex class?
trigger AssignAccNumber on Opportunity(before insert,before update){
    
    List<Id> accIds = new List<Id>();
    
    for(Opportunity opp:trigger.new){
        
        if(opp.AccountId!=null){
            
            accIds.add(opp.AccountId);
        }
    }
    
    Map<Id,Account> accMap = new Map<Id,Account>([SELECT id,Area__c,AccountNumber,Type FROM Account WHERE id in:accIds]);
    Account a = [SELECT AccountNumber FROM Account WHERE AccountNumber != null AND Type='Prospect' AND Area__c='East' ORDER BY AccountNumber DESC LIMIT 1];
    
    for(Opportunity opp :Trigger.new){
     Account accs = accMap.get(opp.AccountId);       
        
	if(!accMap.IsEmpty()){
            
            if(opp.Probability == 95 && accs.AccountNumber == null){
                
                if(accs.LC_Market__c == 'Americas' && accs.Type == 'Prospect'){
                    
                    accs.AccountNumber = String.valueOf(Integer.valueOf(a.AccountNumber)+1);
                }            
            }
            update accMap.values();
        }
    }            
}