• Amdrodd Technologies
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I'm new to trying to use the @InvocableMethod with the process builder and could use a little guidance as I'm not finding the salesforce examples all that helpful.
My class with the method is below:
public without sharing class CM_KeyReplacementEmailSender {
	
	private static String displayName	= 'claims@maximusautogroup.com';
	private static String replyEmail = 'claims@maximusautogroup.com';
	
	@InvocableMethod	
	public static void send(List<ID> id){
		
		List<MG_Claim_Issue__c > iss = [SELECT ID, Name, Contact_Email__c, MAG_Claim__r.Name, Customer_Name__c, Where_will_repair_occur__c FROM MG_Claim_Issue__c WHERE ID =:id];
		Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
		
		String claimNum = iss[0].MAG_Claim__r.Name;
		String issNum = iss[0].Name;
		
		String subject = 'Information regarding open claim with Maximus Auto Group # ' + claimNum;
		
    	String address = iss[0].Contact_Email__c;
    	String[] toAddress = address.split(':', 0);
    	
    	email.setSubject(subject);
		email.setToAddresses(toAddress);
    	email.setSenderDisplayName(displayName);
    	email.setReplyTo(replyEmail);
    	
    	Note note = new Note();
	 	note.Title = 'Email RE: '+ issNum + ' (' + DateTime.now() + ')';
		note.ParentId = iss[0].Id;	
			
    	if(iss[0].Where_will_repair_occur__c == 'Selling Dealer'){
               
        	// Sets the paramaters of the email
			email.setHtmlBody('<p>Test</p>');
    		
    		
			}
		else{
			// Sets the paramaters of the email
			
			email.setHtmlBody('<p>Test2</p>');
    		
			
			}
			// Sends the email
			Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); 	
			note.Body = email.plainTextBody;
			insert note;
			
			
			}

}
I've gotten it to covered with a test class, but when I try and Invoke it from a process builder condition meant to supply the id variable in a practical test I'm not seeing any results.  I'm wondering what I may be missing and would appreciate any insight.
 
If interested, post your contact information here.

Must be able to be set up as a vendor and be paid by a US company.
Hi
I have a VF Page that loads but any fields that have a forumula in them do not display the text on edit is there anyway to fix this so the values are shown?
Thanks
Fiona
I am currently consulting for small to mid-size businesses and need occassional assistance building triggers as Apex is not something I am familiar with.  I am looking to form a partnership of sorts - when I need this type of help I come to you directly rather than trying to figure it out myself as learning code is not something I am particularly interested in.

If you are willing to be an jj"on-call" developer for me and my clients please message me back with your rates and keep in mind that I work for very small clients, sometimes only one user.  Thank you!

Dea Simon