• Nani Sircilla
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 0
    Replies
Hi all,

i have a requirement 
1). standard and custom object list in dropdown list and whenever i select one object then display it's related information
like display all accounts when i select account(Standard) object in dropdown list.
and display all patients when i select Patient__c(custom) object in dropdown list.

Please give me appropriate solution..

thank you
Nani.
Hi All,

My requirement is:
1). open the popup window of email templates whenever i click on the custom button and self close after selecting the one of those email templates.
2). Display the selected email template subject name in the text box and display the body of template in text area.

here, i have created custom pageBlockTable of standard templates.
check it once.. VF page:
 
<apex:page controller="ViewEmailController" showHeader="false" id="pg">  
    <script>
        function getTemplateId(me){
        //var etname = document.getElementById('pg:frm:pb:pbt:id').value;
           //return document.getElementById('id').value = etname;
           alert('hi');
            //alert(document.getElementById('pg:frm:pb:pbt:id:etname');
        }
    </script>
    
    <apex:form id="frm">  
     <apex:pageBlock title="Email Templates" id="pb">  
       <apex:pageBlockTable value="{!emailTemplates}" var="et" id="pbt">  
         
         <apex:column headervalue="Template Name" id="clm">
             <apex:outputLink value="{!et.Id}" onclick="getTemplateId(this)" id="id">
                 <apex:outputText value="{!et.Name}" id="etname"/>
             </apex:outputLink>
          </apex:column>
         <apex:column headervalue="Type" value="{!et.TemplateType}" />
         <apex:column headerValue="Description" value="{!et.Description}"/>
       </apex:pageBlockTable>
       
     </apex:pageBlock>  
    </apex:form>
    
</apex:page>
Controller:
public class ViewEmailController  
 {
     public List<EmailTemplate> emailTemplates;
     public String templateName;
    public ViewEmailController() {
        
    }

    public ViewEmailController(ApexPages.StandardController controller) {

    }
     
   public List<EmailTemplate> getEmailTemplates()  
   {   
       emailTemplates=[SELECT Id, Name, TemplateType, Description from EmailTemplate];  
      
     return emailTemplates;  
   }
    
 }
my requirement look like this:image

Could u pls anyone help me.
Thank you.


 
Hi all,
i have a trigger and i need test class for this trigger. please check it once and give me appropriate solutions.


trigger OppMailTrigger on Opportunity (after insert) {
    
Opportunity i=[select ownerid, id,Owner.manager.email,Name from opportunity where id=:trigger.newMap.keySet()];
user s= [select name from User where id=:i.ownerid];
String userEmail = i.Owner.manager.email; 
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
String[] toAddresses = new String[] {userEmail}; 
mail.setToAddresses(toAddresses); 
mail.setSubject('Automated email: Opportunity created'); 
//String body = 'Hello,'+' '+s.name+'\n\n'+'  '+'On: '+''+system.now()+'\n'+'New Opportunity : '+' '+i.Name+' '+'is Created..'+'\n'+'Click Here..'+''+'https://www.google.co.in/?gfe_rd=cr&ei=cpZJVfviB6jv8wehxIGoDg#q=html+body+structure'; 
String body = '<html><body>Hello,&nbsp;&nbsp;&nbsp;'+ s.name+'<br>On:&nbsp;&nbsp;'+ system.now()+'<br><href>https://ankita26-dev-ed.my.salesforce.com/'+ i.id +'</href></body>  </html>';
//mail.setPlainTextBody(body); 
mail.setHtmlBody(body);
Messaging.sendEmail(new Messaging.SingleEMailMessage[]{mail});
opportunity opp =[SELECT id FROM opportunity Where id in : Trigger.new];
 opp.Active__c=true;
update opp;  
}


Thank you.
Nani.

Hi All,

I have two custom objects lke Student__c(Detail) and Batch__c(Mater). Now whenever delete Batch__c record then delete associated detail records. i have created After Delete trigger on Batch__c with Master-Detail relationship on Student__c. But After trigger not firing on child and just simply delete master records only.
So what should i  do to delete Detail records whenever delete Master record.
 

trigger deleteBatch on Batch__c (After delete) {
    for(Batch__c bt:trigger.old){
    List<Student__c> stu  = [SELECT id FROM Student__c WHERE Id =: bt.id];
    delete stu;
    }   
}


Now my Question is: 1). Which relationship is required on Student__c whether it is Lookup or Master.
2). Can we delete Detail records whenever delete Master record using Lookup field on Detail object.
3) is there any relationship field required on Master object.

Please any one give me answers.

Thank you..
Nani
 

Hi All,

I have two custom objects like Student__c(Detail) and Batch__c(Master). I had created lookup field for Batch__c on Student__c and added some records. But now i want to change lookup field as master detail.

For that i have populated the lookup field with data in all records of Student__c and trying to change the relationship type to Master-Details.
but still getting same error like " You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail. "

Please post the appropriate answer..

Thank you.
Nani.

 
Hi All,

I have two custom objects like Student__c(Detail) and Batch__c(Master). I had created lookup field for Batch__c on Student__c and added some records. But now i want to change lookup field as master detail.

For that i have populated the lookup field with data in all records of Student__c and trying to change the relationship type to Master-Details.
but still getting same error like " You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail. "

Please post the appropriate answer..

Thank you.
Nani.