• jlhmitchell
  • NEWBIE
  • 10 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 9
    Replies
In my apex controller I call a SendEmail() method and it send an email correctly when called from one of my other methods but when I call it from another method in the same controller the body is empty. I have debuged the passed parameters and they are all the exact same as the method that works but it just sends an email with the correct subject with the body empty. The ResendEmail method is the one not working. 
public void SendEmail(ID et) {
        Messaging.SingleEmailMessage mail =new Messaging.SingleEmailMessage();
        Contact recipient = (Contact) currentrecord.getSObject('Contact');
		system.debug(et);
        system.debug(recipient.id);
        mail.saveAsActivity = true;
        mail.setTargetObjectId(recipient.Id);
        mail.setTemplateId(et);
        mail.setWhatId(currentRecord.id);
        system.debug(currentRecord.id);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    }

    public PageReference ResendEmail() {
        system.debug(resendtype);
        String resendtype2 =resendtype.remove('RMA').trim();
        String templateID='';
        templateID= RMA__c.getInstance(resendtype2).Email_Template_ID__c;
        System.debug(templateID);
       
        Contact recipient = (Contact) currentrecord.getSObject('Contact');
        If(recipient.email == null || SkipEmail =='false') {
            system.debug('Email Will not be sent Recipient:' +recipient +' SendEmail:' +SkipEmail);           
        }
        Else {
            system.debug('Email Will be Sent');
            sendemail(templateid);       
        }

        List <Task> updates =new List <Task> ();
        for (Task email: [SELECT ID,Status,RecordTypeID,CreatedDate,Subject FROM Task Where WhatID = :currentrecord.ID Order by CreatedDate DESC limit 1]) {
            email.recordtypeID ='012Q00000004wNk';
            email.Type = resendtype;
            updates.add(email);
            update updates;
        }
        try {
            PageReference parentPage= new PageReference('/apex/RMA?scontrolCaching=1&id=' + currentRecord.Id);
            parentPage.setRedirect(true);
            return parentPage;
        }
        Catch(Exception ex) {
            ApexPages.Message msg =new ApexPages.Message(ApexPages.Severity.Error, ex.getMessage());
            ApexPages.addMessage(msg);
        }
        return null;
    }
Hi
I am experiencing unexpected behavoir with a map that contains sets of strings. The controller is below:
 
public class testbogusmap {
    public map<string,set<string>> BogusMap {get{
         map<string,set<string>> ret = 
                  new map<string,set<string>>();
         set<string> hiSet = new set<String>();
         hiSet.add('ho');
         ret.put('hey',hiSet);   
        return ret; }
    } 
}


The VF page is here:

 
<apex:page controller="testbogusmap">
    {!bogusmap}
    </apex:page>
My VF page displays

{hey=common.apex.runtime.impl.SetValue@d08}

instead of {hey='ho'} which is what is displayed in the developer console.  Why is this?

Thank you!
 

 
I have case-trigger based behavior that will assign a case team member to a case based on a value on a field (exposed and editable by community users). If a contact doesn't exist, the contact is created prior to adding to case team.

This works fine, unless the account owner of the community user is an inactive user. In that scenario, the contact is not created.

I have tried to set the ownerID of the contact on create, but debug is showing me that the failure is still occurring with 
INACTIVE_OWNER_OR_USER, operation performed with inactive user [<Account Owner ID>] as owner of contact: 

My suspicion is that salesforce defaults to account owner ID, but allows on creation a different value (I can verify that the ownerID I set for contact is otherwise used when on an account that is not owned by an inactive user).

Is there something I am missing? Does anyone have suggestions? 
 

This is driving me crazy. I have an object (called WebSurveyQuestion__c) with a lookup field to an object called WebSurveyAnswerType__c. I would expect to have a child relationship on WebSurveyQuestion__c down to the WebSurveyAnswerType__c, but it's the reverse (the WebSurveyAnswerType__c object is the parent).

 

I keep trying to write the query on the question object, as that's where I can limit the results:

 

Select Id, (Select Public_Question_Label__c from WebSurveyQuestions__r), Public_Question_Label__c, Answer_Type__c

From WebSurveyQuestion__c WHERE Public__c = trueAND Parent_Question__c = ''order by Question_Order__c 

 

What I can't figure out is how to get the name for the AnswerType (Answer_Type__c in the above returns the ID, and I want to return the name).

 

What am I missing?

 

Is there some some way to traverse from child to parent? What relationship name would I use (the relationship name is defined for the child on the parent object, but not the opposite)?