• HaiderRaza77
  • NEWBIE
  • 30 Points
  • Member since 2014
  • Salesforce Developer


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
hi,
i have two custom object called functional requirement and system requirement..system requirement object having lookup relationship with functional requirement..When a new SR is created,i need to send email to user which is a user lookup field(Technical_Lead__c) in FR...please help me to query to retrive that user lookup email from FR when SR created...i have created this trigger but when i create record in application it showing error as
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger SREmailSending caused an unexpected exception, contact your administrator: SREmailSending: execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.SREmailSending: line 7, column 1
 
trigger SREmailSending on System_Requirements__c (after insert,after update) {
    List<Messaging.SingleEmailMessage>mails =new List<Messaging.SingleEmailMessage>();
    
  for(System_Requirements__c sr:trigger.new){
    if(sr.Status__c =='Development Completed'){  
         String emailAddr=[Select Email from User where id =:trigger.new[0].Functional_Requirement__r.Technical_Lead__c].Email; 
         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String[] toAddresses = new String[] {emailAddr};
         mail.setToAddresses(toaddresses);
         mail.setSubject('SR Created');
         mail.setPlainTextBody('Status of SR is  Development Completed');
         mails.add(mail);
      }
     
       if(mails.size()>0){
         Messaging.sendEmail(mails);
      }
}

Thanks in advance
Hello everyone 
I have a custom field named "number of leads" associate to a campaign object and I want to calculate a number of leads associate to this company 
when a lead was registred , the value of  "number of leads " became number of leads +1
what can I do ?? 
thank you for your time
  • April 21, 2015
  • Like
  • 0
I have created a button for opportunity and added this button under  contact related list. So when we click  'New Opportunity' button  from contact related list it opens new opp page by populating some values and when we save it saved. But the problem is those records were not visibled in the contact related list. why ? please verify......



/setup/ui/recordtypeselect.jsp?ent=Opportunity&
CF00N40000002fEB2={!Contact.Name}&CF00N40000002fEB2_lkid={!Contact.Id}
&save_new_url=%2F006%2Fe%3Flookupcmpgn%3D1%26&accid={!Account.Id}&retURL={!Contact.Id}
I'm trying to edit multiple records with a list controller extension. I want to use the standard controller {!Save} action, so I only need to use the extension to limit the records I want to show up in my list. The problem is that when I include the list controller extension in my VF page, my edits are not saved. Below is my code for page and extension respectively. Please let me know what I'm doing wrong. If I need to write a custom {!Save} action, please help guide me on how to do that. Thanks for your help!

Visualforce page (called customCommissionEdit):
<apex:page standardController="lda_Commission__c" recordSetVar="TheseCommissions" extensions="extCustomCommissionList">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="quicksave" action="{!quicksave}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!TheseCommissions}" var="comm">
                <apex:column value="{!comm.name}"/>
                <apex:column value="{!comm.Agent_Order__c}"/>
                <apex:column value="{!comm.Agent__c}"/>
                <apex:column value="{!comm.Comm_Dollars__c}"/>
                <apex:column value="{!comm.Comm_Pct__c}"/>
                <apex:column headerValue="Commission Percent">
                    <apex:inputField value="{!comm.Comm_Pct__c}"/>
                </apex:column>
                <apex:column value="{!comm.LAO_Agent__c}"/>
                <apex:column value="{!comm.Role__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller extension (called extCustomCommissionList):
public with sharing class extCustomCommissionList {

    public extCustomCommissionList(ApexPages.StandardSetController controller) {
    }

     public list<lda_Commission__c> getTheseCommissions() {
            return [SELECT DealID__c, Name, Agent__c, LAO_Agent__c, Agent_Order__c, Comm_Dollars__c, Comm_Pct__c, Fiduciary__c, Role__c FROM lda_Commission__c WHERE DealID__c = :ApexPages.currentPage().getParameters().get('id')]; 
        } 
}

The lda_Commission__c object that I'm trying to edit is a child to another object, so I just want the user to edit the related child lda_Commission__c.

 
Hi All,

I have created a new apex class and vf page to insert data into a custom object. I am able to insert record in custom object but values are not displaying in record which i have given in vf page.

Kindly help me to solve this

VF Page
<apex:page standardcontroller="Claims__c" extensions="NotesController11">
<apex:form>
<h1 style="font-size:30px"><Center> Reinsurance Verification</center> </h1>
<apex:pageBlock id="Details">
<apex:pageBlockSection columns="2" title="Company Information">
<apex:inputfield value="{!Test.Claim_Numbers__c}"/> 
</apex:pageBlockSection>            
</apex:pageBlock>
<apex:outputPanel layout="block">
<apex:commandButton value="Save and Close" action="{!Save}" immediate="true" /> 
</apex:outputPanel>                          
</apex:form>                               
</apex:page>

Apex Controller

public class NotesController11 {

    public Claims__c Test{get; set;}
    public NotesController11(ApexPages.StandardController controller) {
        test= new Claims__c();
        }

    public PageReference Save() {
 
        Claims__c rv = new Claims__c();
        rv.Claim_Numbers__c= Test.Claim_Numbers__c;
        insert rv;
        PageReference Page = new PageReference('/'+rv.id);
        Page.setRedirect(true);
        return Page;

    }

}

Output:

User-added image
  • December 30, 2015
  • Like
  • 0
hi,
i have two custom object called functional requirement and system requirement..system requirement object having lookup relationship with functional requirement..When a new SR is created,i need to send email to user which is a user lookup field(Technical_Lead__c) in FR...please help me to query to retrive that user lookup email from FR when SR created...i have created this trigger but when i create record in application it showing error as
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger SREmailSending caused an unexpected exception, contact your administrator: SREmailSending: execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.SREmailSending: line 7, column 1
 
trigger SREmailSending on System_Requirements__c (after insert,after update) {
    List<Messaging.SingleEmailMessage>mails =new List<Messaging.SingleEmailMessage>();
    
  for(System_Requirements__c sr:trigger.new){
    if(sr.Status__c =='Development Completed'){  
         String emailAddr=[Select Email from User where id =:trigger.new[0].Functional_Requirement__r.Technical_Lead__c].Email; 
         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String[] toAddresses = new String[] {emailAddr};
         mail.setToAddresses(toaddresses);
         mail.setSubject('SR Created');
         mail.setPlainTextBody('Status of SR is  Development Completed');
         mails.add(mail);
      }
     
       if(mails.size()>0){
         Messaging.sendEmail(mails);
      }
}

Thanks in advance