• Prasanna_24
  • NEWBIE
  • 9 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 1
    Replies
Hi,

I have one standard object(CONTACT) and Custom object(EVENT) .Event custom object has a lookup relationship to the contact object through a lookup field "Contact Name".

One of the field of Event custom object is "Event Type"(picklistfield).

My Requirement is: If one of the particular even type is selected(for ex: "Birthday" Event type) The email should be sent to the contact's owner saying to organize some lunch meeting

Issue Facing: When i am trying to create an email alert,i am unable to find the "contact's owner name" in the recipient's list.

Can anyone help me out??what is the reason behind it?

Thanks in Advance for ur help!!
Hi,

I have  created a trigger handler class and when i try to run test class,it is giving errors as follows

Error MessageSystem.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, NbdsEappValidation: execution of AfterInsert

caused by: System.DmlException: Update failed. First exception on row 0 with id a0u21000000EquXAAS; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, NbdsEappValidation: execution of BeforeUpdate

caused by: System.FinalException: Record is read-only

Class.NbdsEappValidationTriggerHandler.OnBeforeUpdate: line 39, column 1
Trigger.NbdsEappValidation: line 21, column 1: []

Class.NbdsEappValidationTriggerHandler.OnAfterInsert: line 59, column 1
Trigger.NbdsEappValidation: line 26, column 1: []



Here is my Trigger:
==============


trigger NbdsEappValidation on NBDS_eApp__c (before insert, before update, after insert, after update) {
       
       NbdsEappValidationTriggerHandler handler = new NbdsEappValidationTriggerHandler(false);
       
                if ( trigger.isBefore ) {
                                if ( trigger.isInsert ) {
                                                Handler.onBeforeInsert(trigger.new);
                                } else if ( trigger.isUpdate ) {
                                                Handler.onBeforeUpdate(trigger.new, trigger.oldMap);
                                } 
                                
                } else if ( trigger.isAfter ) {
                                if ( trigger.isInsert ) {
                                                Handler.onAfterInsert(trigger.new);
                                } else if ( trigger.isUpdate ) {
                                                Handler.onAfterUpdate(trigger.new, trigger.oldMap);
                                }
                                
                }


Here is my Handler class:
===================


public with sharing class NbdsEappValidationTriggerHandler {

        private boolean m_isExecuting = false;

public NbdsEappValidationTriggerHandler(boolean isExecuting){
            m_isExecuting = isExecuting;

}

public void OnBeforeInsert(List<NBDS_eApp__c> listeApp){
//Check if the Data Entry Complete-Validate on Save flag is true
    //If true set sectionidentifier to All before insert and update
        for (NBDS_eApp__c eApp : listeApp) {
            if(eApp.NBDS_DataEntry_Complete_Validate_on_Save__c==true)
                eApp.SectionIdentifier__c='All';
                }       
}

public void OnBeforeUpdate(List<NBDS_eApp__c> listeApp, Map<id,NBDS_eApp__c> MapeAppOld){
        
         for (NBDS_eApp__c eApp : listeApp) {
            if(eApp.NBDS_DataEntry_Complete_Validate_on_Save__c==true)
                eApp.SectionIdentifier__c='All';
                }   
                
                
                             
         for(NBDS_eApp__c eApp:MapeAppOld.values()){
            if(eApp.NBDS_DataEntry_Complete_Validate_on_Save__c==true)
            {
                            eApp.SectionIdentifier__c='All';                                
             }
                }
}

public void OnAfterInsert(List<NBDS_eApp__c> listeApp) {
//Reset Data Entry Complete-Validate on Save flag is false
    //SectionIdentifier value to ''
        List<NBDS_eApp__c> listeApp1=new List<NBDS_eApp__c>();
            for (NBDS_eApp__c eApp : listeApp) {
                if(eApp.NBDS_DataEntry_Complete_Validate_on_Save__c==true) {
//Use fresh object to update only those fields that require updating
                  NBDS_eApp__c ueApp=new NBDS_eApp__c();
                  ueApp.Id = eApp.Id;
                  ueApp.SectionIdentifier__c=null;
                  ueApp.NBDS_DataEntry_Complete_Validate_on_Save__c=false;
                  listeApp1.add(ueApp);
            }
        }
//Update only if there are records
        if(listeApp1.size()>0)
            update listeApp1;
    }

public void OnAfterUpdate(List<NBDS_eApp__c>  listeApp, map<id,NBDS_eApp__c> MapeAppOld){
        List<NBDS_eApp__c> listeApp1=new List<NBDS_eApp__c>();
            for (NBDS_eApp__c eApp : listeApp) {
            if(eApp.NBDS_DataEntry_Complete_Validate_on_Save__c==true) {
//Use fresh object to update only those fields that require updating
                NBDS_eApp__c ueApp=new NBDS_eApp__c();
                ueApp.Id = eApp.Id;
                ueApp.SectionIdentifier__c=null;
                ueApp.NBDS_DataEntry_Complete_Validate_on_Save__c=false;
                listeApp1.add(ueApp);
            }
        }        
//Update only if there are records
        if(listeApp1.size()>0)
            update listeApp1;
            
           List<NBDS_eApp__c> listeApp2=new List<NBDS_eApp__c>();  
             for (NBDS_eApp__c eApp : MapeAppold.values()) {
            if(eApp.NBDS_DataEntry_Complete_Validate_on_Save__c==true) {
//Use fresh object to update only those fields that require updating
                NBDS_eApp__c ueApp=new NBDS_eApp__c();
                ueApp.Id = eApp.Id;
                ueApp.SectionIdentifier__c=null;
                ueApp.NBDS_DataEntry_Complete_Validate_on_Save__c=false;
                listeApp2.add(ueApp);
            }
}
//Update only if there are records
        if(listeApp2.size()>0)
            update listeApp2;           
}
}


Your answers will be highly helpful for me!!Thanks in Advance!!
Hi,

I have a page with checkbox included in it.When this checkbox is selected,it should run the validation rules and display the error messages accordingly.When this checkbox is not selected,it should skip the validation rules and the record should save without displaying errors.

How can i achieve this requirement using before triggers??

Your answers will be highly helpful.
Hi,

I am writting a simple code to devlelop a VF page using standard list controller and having a doubt.In my code below,i used a SAVE button and Inline Edit command inorder to edit any record and save.Inline edit is working properly where as the edited record is not getting saved as expected.After saving,the record is not getting updated.Can anyone help me out on this.

Your help will be highly useful.

Here is my code.
<apex:page standardController="Account" recordSetVar="Acts">
 <apex:form >
   <apex:pageBlock title="List of Accounts using standard list controller"> 
   
     <apex:pageBlockTable value="{!Acts}" var="a">
         <apex:column value="{!a.name}"/>
         <apex:column value="{!a.industry}"/>
         <apex:column value="{!a.type}"/>
         <apex:column value="{!a.phone}"/>
        
    </apex:pageBlockTable>
    </apex:pageBlock>
    <apex:commandButton value="Save" action="{!Quicksave}"/>
  <apex:inlineEditSupport />
  
    </apex:form>
</apex:page>
Hi,

Can you help me out by answering these questions.

1)A company has a custom object named Warehouse.Each warehouse record has a distinct record owner,and is related to parent Account in salesforce.

A.One-to-Many
B.Lookup
C.Master-Detail
D.Parent-Child

2)To which primitive data type in Apex is a currency field automatically assigned?

   A.Integer
   B.Decimal
   C.Double
   D.Currency



 
Hi,
Can you please help me out by answering these questions.
A company wants a recruiting app that models candidates and interviews; displays the total number of interviews on each candidate record; and defines security on interview records that is independent from the security on candidate records.What would a developer do to accomplish this task? 
Choose 2 answers.
A) Create a lookup relationship between the Candidate and Interview objects.
B) Create a trigger on the Interview object that updates a field on the Candidate object
C) Create a roll-up summary field on the Candidate object that counts Interview records.
D) Create a master-detail relationship between the Candidate and Interview objects.
 
Hoping the Ans as :A,B

2) In the Lightning Component framework, which resource can be used to fire events?ans: A,B
Choose 2 answers
Third-party Javascript code.
Javascript controller actions.
Visualforce controller actions.
Third-party web service code.

Hoping as Ans: A,B

3) What is a capability of formula fields? 
 
   Choose 3 answer 
 
A) Generate a link using the HIPERLINK function to a specific record in a legacy system
B) Determine if a datetime field has passed using the NOW function
C) Determine which of three different images to display using IF function
D) Return and display a field value from another object using the VLOOKUP function
E) Display the previous value for a field using the PRIORVALUE funtion

I think Ans: B,C,D

4)A developer wants to display all the available record types for a case Object. The developer also wants to display the picklist values for the Case.Status field. The Case Object and the Case.Status field are on a Custom Visualforce page.
Which action can the developer perform to get the record types and picklist values in the controller?
Choose 2 answers. 
Use Schema.PicklistEntry returned by Case.Status.getDescribe().getPicklistValues()
Use Schema.RecordTypeInfo returned by Case.sObjectType.getDescribe().getRecordTypeInfos()
Use SOQL to query Case records in the org to get all values for the Status picklist field
Use SOQL to query Case records in the org to get all the RecordType values available for Case 

I think Ans:A,B

5) A developer writes a SOQL query to find child records for a specific parent. Ans:5



 



How many levels can be returned in a single query?

A. 1
B. 7
C. 5
D. 3
 
Confused between option A and C.Please clarify these questions.

Thanks in advance for your help.


 
Hi,
Can you please help me out by answering these questions.
A company wants a recruiting app that models candidates and interviews; displays the total number of interviews on each candidate record; and defines security on interview records that is independent from the security on candidate records.What would a developer do to accomplish this task? 
Choose 2 answers.
A) Create a lookup relationship between the Candidate and Interview objects.
B) Create a trigger on the Interview object that updates a field on the Candidate object
C) Create a roll-up summary field on the Candidate object that counts Interview records.
D) Create a master-detail relationship between the Candidate and Interview objects.
 
Hoping the Ans as :A,B

2) In the Lightning Component framework, which resource can be used to fire events?ans: A,B
Choose 2 answers
Third-party Javascript code.
Javascript controller actions.
Visualforce controller actions.
Third-party web service code.

Hoping as Ans: A,B

3) What is a capability of formula fields? 
 
   Choose 3 answer 
 
A) Generate a link using the HIPERLINK function to a specific record in a legacy system
B) Determine if a datetime field has passed using the NOW function
C) Determine which of three different images to display using IF function
D) Return and display a field value from another object using the VLOOKUP function
E) Display the previous value for a field using the PRIORVALUE funtion

I think Ans: B,C,D

4)A developer wants to display all the available record types for a case Object. The developer also wants to display the picklist values for the Case.Status field. The Case Object and the Case.Status field are on a Custom Visualforce page.
Which action can the developer perform to get the record types and picklist values in the controller?
Choose 2 answers. 
Use Schema.PicklistEntry returned by Case.Status.getDescribe().getPicklistValues()
Use Schema.RecordTypeInfo returned by Case.sObjectType.getDescribe().getRecordTypeInfos()
Use SOQL to query Case records in the org to get all values for the Status picklist field
Use SOQL to query Case records in the org to get all the RecordType values available for Case 

I think Ans:A,B

5) A developer writes a SOQL query to find child records for a specific parent. Ans:5



 



How many levels can be returned in a single query?

A. 1
B. 7
C. 5
D. 3
 
Confused between option A and C.Please clarify these questions.

Thanks in advance for your help.