• Lakshmi S
  • NEWBIE
  • 439 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 73
    Questions
  • 55
    Replies
I am not getting any selectd options in the SelectOption list to show on my Visual Force page. Beow is the VF snippet and controller.

Example
public class sampleConSubmissions {
    
     String[] submissions = new String[]{};

    public sampleConSubmissions(ApexPages.StandardController controller) {

    }
        
            
        public PageReference test() {
            return null;
        }
            
        public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('TR00025712016 - Umbr only','TR00025712016 - Umbr only'));
            options.add(new SelectOption('TR00028982016 - Casualty','TR00028982016 - Casualty'));
            options.add(new SelectOption('TR18622016 - Casualty','TR18622016 - Casualty'));
            options.add(new SelectOption('TR20612016 - Property','TR20612016 - Property'));
            return options;
        }
            
        public String[] getsubmissions() {
            return submissions;
        }
            
        public void setsubmissions(String[] submissions) {
            this.submissions = submissions;
        }
    }
 
<apex:selectList value="{!submissions}" multiselect="true">
            <apex:selectOptions value="{!items}"/>
        </apex:selectList><p/>

        <apex:commandButton value="Select Submissions" action="{!test}" rerender="out" status="status"/>
    

    <apex:outputPanel id="out">
        <apex:actionstatus id="status" startText="testing...">
            <apex:facet name="stop">
                <apex:outputPanel >
                    <p>You have selected:</p>
                    <apex:dataList value="{!submissions}" var="c">{!c}</apex:dataList>
                </apex:outputPanel>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputPanel>

 
Hi Team,


1. Write a test class for Rollup Summary Trigger , must cover 100% code coverage?
2. Without writing Test class shall we deploy the Trigger from Sandbox to Produntion. Explain?

Trigger Code :
 
trigger RolllupSummaryOppAmt on Opportunity (After insert, After update,After delete, After undelete) {
    if(checkRecursive.runOnce()){
    Set<Id> accid = new Set<Id>();
    Decimal avgamt;
    Decimal sumamt;
        Integer noopp;
    if(Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete){
        for(Opportunity opp : Trigger.New){
            if(opp.AccountId != null){
                accid.add(opp.AccountId);
            }
            
        }
    }
    
    if(Trigger.isDelete || Trigger.isUpdate){
        for(Opportunity op : Trigger.Old){
            if(op.AccountId != null){
                accid.add(op.AccountId);
            }
            
        }
    }
        
    List<Account> aclist = [select id,OppAvgAmount__c,SumOfOppAmt__c,NoOfOpp__c,(select id,amount from opportunities) from account where id In :accid];
    List<Account> upacc = new List<Account>();
    if(aclist.size()>0){
        for(Account ac : aclist){
           
            List<AggregateResult> aglist = [select count(id)t,avg(amount)agg,min(amount)sumamt from opportunity where accountid = :ac.id];
            for(AggregateResult ag : aglist){
                avgamt = (Decimal)ag.get('agg');
                sumamt = (Decimal)ag.get('sumamt');
                noopp = (Integer)ag.get('t');
                system.debug('---average---:'+avgamt);
            }
            ac.OppAvgAmount__c = avgamt;
            ac.SumOfOppAmt__c = sumamt;
            ac.NoOfOpp__c = noopp;
            upacc.add(ac);
        }
        
            update upacc;
       
    }

    }
}


Thanks
Lakshmi.
Hi Team,

Q). What are the issues or errors we are facing at the time of writing  visualforce pages and apex classes?
Kindly reply to this post .......

Regards
Lakshmi
Hi Team,


Can any one please tell me the challenges facing in Salesforce Administration?


Thanks & Regards
Lakshmi
Hi Team,


What are the challenges facing in apex code development ?


Thanks & Regards
Lakshmi.
Hi Team,

What are the challenges we are facimg in deployment using ANT migration tool?


Thanks & Regards
Lakshmi
Hi Team,


Write a batch class for to delete all contacts of accounts where Account field : active__c="yes" ?


Please give me the reply to above scenario....

Regards
Lakshmi
Hi Team,

1. The api first approach to development at salesforce lets customers ?
 a) Extend functionality across Salesforce features.
 b) Choose the API that's best suited to their needs
 c) Build apps for the App Exchange.
 d) All the above.

2. soap api is best  suited for which of these use cases ? (choose the best option)
 a). Building server to server integration.
 b). Writing an app that requires using JSON
 c). Updating thousands of records at once.
 d) Building slick ui for mobile app.

3. Which of the following statements about Queues are true? (Select all that apply)
 a) Ownership of a record assigned to a queue may be taken by any user in the queue or those above them on the role hierarchy.
 b) sharing settings can allow other groups,roles,profiles or users acess to a Queue.
 c) Queues route reuests sequentially tough a pool of users.
 d) a list view is automatically created for a new queue.
 e) queue define a pool of users that own an object.

4. what is the limit of debug logs retained in an organization?
 a) 75 logs
 b) 100 mb
 c) 50 mb
 d) 20 logs

5. Validation rules dont apply if you create new records for an object with Quick Create ?
 a) True
 b) False

6. which is true about encrypted custom fields ? ( select all that apply)
 a) They cannot be set to unique.
 b) They cannot be type email.
 c) They cannot be edited while encrypted.
 d) They cannot be external ID
 e) They cannot have default values.

7. What function only works on validation rule
a) htmlencode
b) vlookup
c) regex
d) ispickval
e) image

8. Which of the following statements is true about external callout?
a) SOAP callouts use xml and may use a wsdl for code generation.
b) HTTP callouts typically use JSON but can use XML as well.
c) HTTP callouts are generally easier to work with than SOAP callouts.
d) All of the above.

9. A user profile may grant a user the potential to see records of an object, but the sharing model determines which records that user can see ?
a) True
b) False
 

Please give me the reply for above questions.

Regards
Lakshmi.

 
HI Team


1. if the modifiable system fields feature turned on the created date can changed for an existing record using the api?
 a) true
 b) false

2. Bulk api is best suited for which of these use cases?
 a) Deleting several records, one record at a time.
 b) Writing a mobile chat app.
 c) Building a new salesforce ui
 d) Deleting 100,000 records at once.

3. you are setting up a profile to be used with integration software. which profile permissions should this profile have?(select all that apply.)
 a) customize application.
 b) password never expires.
 c) api only user.
 d) manage data categories.
 e) modify all data.

4. what are ways in which a record id can be obtained ? (select all that apply)
 a) web services api
 b) url
 c) page layout
 d) report
 e) settings panel

5. what actions are tracked in debug logs?
 a) apex code.
 b) data values for fields.
 c) setting changes.
 d) validation rules
 e) callouts


Please give me the reply for above questions.

Regards
Lakshmi
HI Team,

1. Validation rules apply to new and updated records for an object, even if the fields referenced in the validation rule are not included in a page layout or an API call
 a) True
 b) False

2. When is cross object formula calculated?
 a). When it is viewed.
 b). When related object record created or updated.
 c). When the record is created or updated.
 d). When an update is scheduled.

3. soap webservices commonly used for ?
 a). simple light weight services that are typically stateless
 b). Public APIs that use HTTP and JSON
 c). Enterprise apps that require a formal exchange format or stateful operations.
 d). No one uses SOAP any longer.. it's four letter word.

4. The setup audit trail tracks changes to which of the following items?
 a). email address changes.
 b). approval processes completion.
 c). page layout changes.
 d). record updates.
 e).chatter posts

5. which of the following salesforce 1 app requirements would be most likely to push you in the direction of using programmatic tools like visualforce ? (Choose the best answer)
 a). Governor limits.
 b). A need to use custom objects and fields to track data specific to your business.
 c). A need to support a complex business process with a highly customized user interface and click through path.
 d). A need for full access to all data stored in salesforce.

Please give me the reply to above questions....


Regards
Lakshmi
Hi Team,

1. What does the salesforce.com sharing model determines? (select all that apply)
 a) who has access to records
 b) which tabs that can access records through
 c) what level of access to records
 d) why they have access to records

2) A log of the last 20 changes will be kept when a custom objects 'Track field history' checkbox is checked?
 a) True
 b) False

3) You want to configure your app to handle your company's warranty policy. which kind of custom metadata type most closely fits this scenario?
 a) Business ruels
 b) Master data
 c) Mapping
 d) This solution is not a good application for custom metadata types

4) Which statements are true about modifiable system fields? (Select all tthat apply)
 a ) works for all custom objects
 b) only available for users with the standard system admin profile
 c) only accessble through api
 d) modifiable systemfields setting can be turned on and off by administrator
 e) read-only for existing records.

5) Field types for history tracking? (select all that apply)
 a) text (encrypted)
 b) lookup relation ship
 c) text area (long)
 d) text area (rich)
 e) picklist (multi select)

Please give me the answers for above questions?

Regards
Lakshmi

 
Hi Team,

Greetings for the Day!
Scenario : How to track Visualforce page visitor name and time?
Please guide to me how to write the code for above scenario.


Regards
Lakshmi
Hi Team,

Q). I have a 3 Objects A,B,C.
Object A is the parent of B, Object B is the parent of C.
How can we get the data from all three objects using single SOQL Query ?


Thanks in Advance..............
Regards
Lakshmi.
 
Hi Team,

Is is possible to write Asynchronous Trigger?

Regards
Lakshmi
Hi Team

I have a requirement track the user name and time who viewed the visualforce page?
How to achieve this?
Kindly help me any one

Thanks in advance
Regards
Lakshmi
Hi Dev's,

How to execute below WSDL2 Apex class in Execute anonymous window.
Class :
-----------
public class ParkLocator {
    public static String[] country(String country){
        ParkService.ParksImplPort park = new ParkService.ParksImplPort();
        String[] parkname= park.byCountry(country);
        return parkname;
    }

}


Thanks in Advance.
HI Dev's

I am trying to 100% code coverage, but this test class covers only 75%. How can we achieve that?
Please guide me any one.

Trigger
----------
trigger AccountDuplicateTrigger on Account (before insert,before update) {
    
    for(Account acc : Trigger.New){
        for(Account ac : [Select id,name from Account]){
            if(acc.name == ac.name && acc.name != Trigger.oldmap.get(acc.Id).name){
                acc.Name.addError('You cannot create duplicate Account');
            }
        }
    }
    
}

Test Class
---------------
@isTest
public class TestAccountDuplicateTrigger {
    static testMethod void test(){
        boolean result = false;
        Account a =new Account(name='Demo');
        insert a;
        Account aa = new Account(name='Demo');
        
        try{
            Database.insert(aa);
        }
        catch(DMLException de){
            
            result=true;
            System.assert(result);
            System.assert(de.getMessage().contains('You cannot create duplicate Account'));
        }
    }

}



Thanks in Advance
Lakshmi
Hi Dev's

Q). Calculate Average value using custom rollup summary using trigger.
 Objects : Account (parent) - Opportunity(child) -- I want to calculate average amount from opportunity and display in account object.

Program:

trigger RolllupSummaryOppAmt on Opportunity (After insert, After update,After delete, After undelete) {
    Set<Id> accid = new Set<Id>();
    Decimal avgamt;
    if(Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete){
        for(Opportunity opp : Trigger.New){
            if(opp.AccountId != null){
                accid.add(opp.AccountId);
            }
            
        }
    }
    
    if(Trigger.isUpdate || Trigger.isDelete){
        for(Opportunity op : Trigger.Old){
            if(op.AccountId != null){
                accid.add(op.AccountId);
            }
            
        }
    }
        
    List<Account> aclist = [select id,OppAvgAmount__c,(select id,amount from opportunities) from account where id In :accid];
    List<Account> upacc = new List<Account>();
    if(aclist.size()>0){
        for(Account ac : aclist){
           
            List<AggregateResult> aglist = [select avg(amount)agg from opportunity where accountid = :ac.id];
            for(AggregateResult ag : aglist){
                avgamt = (Decimal)ag.get('agg');
                system.debug('---average---:'+avgamt);
            }
            ac.OppAvgAmount__c = avgamt;
            upacc.add(ac);
        }
        
            update upacc;
       
           }

}



Error : Error:Apex trigger RolllupSummaryOppAmt caused an unexpected exception, contact your administrator: RolllupSummaryOppAmt: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0016F00001tLWYSQA4; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trig_Demo_Update_Opp: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0066F00000n7Je2QAE; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, RolllupSummaryOppAmt: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0016F00001tLWYSQA4; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0016F00001tLWYS) is currently in trigger Trig_Demo_Update_Opp, therefore it cannot recursively update itself: [] Trigger.RolllupSummaryOppAmt: line 24, column 1: [] Trigger.Trig_Demo_Update_Opp: line 13, column 1: []: Trigger.RolllupSummaryOppAmt: line 24, column 1


Please give me the solution to this issue;

Regards
Lakshmi
Hi Dev's

trigger onecontactforoneaccount on Contact (before insert,before update) {

    if(Trigger.isInsert || Trigger.isUpdate){
        for(Contact con : Trigger.New){
            for(Contact c : [Select id,accountid from contact]){
                if(con.accountid == c.accountid && con.accountid != Trigger.oldmap.get(con.id).accountid){
                    Trigger.oldmap.get(con.id).addError('Duplicate account id');
                }
        }
        }
    }
}


Regards
Lakshmi
Hi Dev's

Apex class (constructor, methods, getter & setter properties) order of execution?

Regards
Lakhsmi
Hi Dev's,

SOQL query for fetching records from Account not related to Contact object?(Only account records, which are not related to contact)?

Regards
Lakshmi

Thanks in advance..
 
Hi All,

Q). One object (s1) & 3 tasks (t1, t2, t3) are there. Each task performing discount related stuff.
   Write a trigger that should calculate the sum of 3 tasks.  And if any task is modified than trigger should fire automatically & perform the same.


Can any one reply for this post..
Thanks in advance
 
Hi All,

Q). what is the difference between actionFunction and actionSupport, Explain with funcionality?

can anyone reply for this post...
Thanks in advance..
Hi All,

Q). 3 users with same profile (R/W permissions), need to remove Read permission for one user, how can we achieve that?

Can anyone reply for this post...
Thanks in advance.
Hi All,

Q). What is a future method ? When we are going to use Future methods? Example program for Future method and Schedulable class for Future method?

Give me reply anyone.....
HI All,

Q). What is a Batch Apex,Queueable Apex and @Future methods?, What are the differences between them and when we are going to use these classes?
Can anyone explain these classes.......
 
Hi Team,


1. Write a test class for Rollup Summary Trigger , must cover 100% code coverage?
2. Without writing Test class shall we deploy the Trigger from Sandbox to Produntion. Explain?

Trigger Code :
 
trigger RolllupSummaryOppAmt on Opportunity (After insert, After update,After delete, After undelete) {
    if(checkRecursive.runOnce()){
    Set<Id> accid = new Set<Id>();
    Decimal avgamt;
    Decimal sumamt;
        Integer noopp;
    if(Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete){
        for(Opportunity opp : Trigger.New){
            if(opp.AccountId != null){
                accid.add(opp.AccountId);
            }
            
        }
    }
    
    if(Trigger.isDelete || Trigger.isUpdate){
        for(Opportunity op : Trigger.Old){
            if(op.AccountId != null){
                accid.add(op.AccountId);
            }
            
        }
    }
        
    List<Account> aclist = [select id,OppAvgAmount__c,SumOfOppAmt__c,NoOfOpp__c,(select id,amount from opportunities) from account where id In :accid];
    List<Account> upacc = new List<Account>();
    if(aclist.size()>0){
        for(Account ac : aclist){
           
            List<AggregateResult> aglist = [select count(id)t,avg(amount)agg,min(amount)sumamt from opportunity where accountid = :ac.id];
            for(AggregateResult ag : aglist){
                avgamt = (Decimal)ag.get('agg');
                sumamt = (Decimal)ag.get('sumamt');
                noopp = (Integer)ag.get('t');
                system.debug('---average---:'+avgamt);
            }
            ac.OppAvgAmount__c = avgamt;
            ac.SumOfOppAmt__c = sumamt;
            ac.NoOfOpp__c = noopp;
            upacc.add(ac);
        }
        
            update upacc;
       
    }

    }
}


Thanks
Lakshmi.
Hi Team,

Q). What are the issues or errors we are facing at the time of writing  visualforce pages and apex classes?
Kindly reply to this post .......

Regards
Lakshmi
Hi Team,


Can any one please tell me the challenges facing in Salesforce Administration?


Thanks & Regards
Lakshmi
Hi Team,


Write a batch class for to delete all contacts of accounts where Account field : active__c="yes" ?


Please give me the reply to above scenario....

Regards
Lakshmi
Hi Team,

1. The api first approach to development at salesforce lets customers ?
 a) Extend functionality across Salesforce features.
 b) Choose the API that's best suited to their needs
 c) Build apps for the App Exchange.
 d) All the above.

2. soap api is best  suited for which of these use cases ? (choose the best option)
 a). Building server to server integration.
 b). Writing an app that requires using JSON
 c). Updating thousands of records at once.
 d) Building slick ui for mobile app.

3. Which of the following statements about Queues are true? (Select all that apply)
 a) Ownership of a record assigned to a queue may be taken by any user in the queue or those above them on the role hierarchy.
 b) sharing settings can allow other groups,roles,profiles or users acess to a Queue.
 c) Queues route reuests sequentially tough a pool of users.
 d) a list view is automatically created for a new queue.
 e) queue define a pool of users that own an object.

4. what is the limit of debug logs retained in an organization?
 a) 75 logs
 b) 100 mb
 c) 50 mb
 d) 20 logs

5. Validation rules dont apply if you create new records for an object with Quick Create ?
 a) True
 b) False

6. which is true about encrypted custom fields ? ( select all that apply)
 a) They cannot be set to unique.
 b) They cannot be type email.
 c) They cannot be edited while encrypted.
 d) They cannot be external ID
 e) They cannot have default values.

7. What function only works on validation rule
a) htmlencode
b) vlookup
c) regex
d) ispickval
e) image

8. Which of the following statements is true about external callout?
a) SOAP callouts use xml and may use a wsdl for code generation.
b) HTTP callouts typically use JSON but can use XML as well.
c) HTTP callouts are generally easier to work with than SOAP callouts.
d) All of the above.

9. A user profile may grant a user the potential to see records of an object, but the sharing model determines which records that user can see ?
a) True
b) False
 

Please give me the reply for above questions.

Regards
Lakshmi.

 
HI Team


1. if the modifiable system fields feature turned on the created date can changed for an existing record using the api?
 a) true
 b) false

2. Bulk api is best suited for which of these use cases?
 a) Deleting several records, one record at a time.
 b) Writing a mobile chat app.
 c) Building a new salesforce ui
 d) Deleting 100,000 records at once.

3. you are setting up a profile to be used with integration software. which profile permissions should this profile have?(select all that apply.)
 a) customize application.
 b) password never expires.
 c) api only user.
 d) manage data categories.
 e) modify all data.

4. what are ways in which a record id can be obtained ? (select all that apply)
 a) web services api
 b) url
 c) page layout
 d) report
 e) settings panel

5. what actions are tracked in debug logs?
 a) apex code.
 b) data values for fields.
 c) setting changes.
 d) validation rules
 e) callouts


Please give me the reply for above questions.

Regards
Lakshmi
HI Team,

1. Validation rules apply to new and updated records for an object, even if the fields referenced in the validation rule are not included in a page layout or an API call
 a) True
 b) False

2. When is cross object formula calculated?
 a). When it is viewed.
 b). When related object record created or updated.
 c). When the record is created or updated.
 d). When an update is scheduled.

3. soap webservices commonly used for ?
 a). simple light weight services that are typically stateless
 b). Public APIs that use HTTP and JSON
 c). Enterprise apps that require a formal exchange format or stateful operations.
 d). No one uses SOAP any longer.. it's four letter word.

4. The setup audit trail tracks changes to which of the following items?
 a). email address changes.
 b). approval processes completion.
 c). page layout changes.
 d). record updates.
 e).chatter posts

5. which of the following salesforce 1 app requirements would be most likely to push you in the direction of using programmatic tools like visualforce ? (Choose the best answer)
 a). Governor limits.
 b). A need to use custom objects and fields to track data specific to your business.
 c). A need to support a complex business process with a highly customized user interface and click through path.
 d). A need for full access to all data stored in salesforce.

Please give me the reply to above questions....


Regards
Lakshmi
Hi Team,

Q). I have a 3 Objects A,B,C.
Object A is the parent of B, Object B is the parent of C.
How can we get the data from all three objects using single SOQL Query ?


Thanks in Advance..............
Regards
Lakshmi.
 
Hi Dev's,

How to execute below WSDL2 Apex class in Execute anonymous window.
Class :
-----------
public class ParkLocator {
    public static String[] country(String country){
        ParkService.ParksImplPort park = new ParkService.ParksImplPort();
        String[] parkname= park.byCountry(country);
        return parkname;
    }

}


Thanks in Advance.
HI Dev's

I am trying to 100% code coverage, but this test class covers only 75%. How can we achieve that?
Please guide me any one.

Trigger
----------
trigger AccountDuplicateTrigger on Account (before insert,before update) {
    
    for(Account acc : Trigger.New){
        for(Account ac : [Select id,name from Account]){
            if(acc.name == ac.name && acc.name != Trigger.oldmap.get(acc.Id).name){
                acc.Name.addError('You cannot create duplicate Account');
            }
        }
    }
    
}

Test Class
---------------
@isTest
public class TestAccountDuplicateTrigger {
    static testMethod void test(){
        boolean result = false;
        Account a =new Account(name='Demo');
        insert a;
        Account aa = new Account(name='Demo');
        
        try{
            Database.insert(aa);
        }
        catch(DMLException de){
            
            result=true;
            System.assert(result);
            System.assert(de.getMessage().contains('You cannot create duplicate Account'));
        }
    }

}



Thanks in Advance
Lakshmi
Hi Dev's

Q). Calculate Average value using custom rollup summary using trigger.
 Objects : Account (parent) - Opportunity(child) -- I want to calculate average amount from opportunity and display in account object.

Program:

trigger RolllupSummaryOppAmt on Opportunity (After insert, After update,After delete, After undelete) {
    Set<Id> accid = new Set<Id>();
    Decimal avgamt;
    if(Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete){
        for(Opportunity opp : Trigger.New){
            if(opp.AccountId != null){
                accid.add(opp.AccountId);
            }
            
        }
    }
    
    if(Trigger.isUpdate || Trigger.isDelete){
        for(Opportunity op : Trigger.Old){
            if(op.AccountId != null){
                accid.add(op.AccountId);
            }
            
        }
    }
        
    List<Account> aclist = [select id,OppAvgAmount__c,(select id,amount from opportunities) from account where id In :accid];
    List<Account> upacc = new List<Account>();
    if(aclist.size()>0){
        for(Account ac : aclist){
           
            List<AggregateResult> aglist = [select avg(amount)agg from opportunity where accountid = :ac.id];
            for(AggregateResult ag : aglist){
                avgamt = (Decimal)ag.get('agg');
                system.debug('---average---:'+avgamt);
            }
            ac.OppAvgAmount__c = avgamt;
            upacc.add(ac);
        }
        
            update upacc;
       
           }

}



Error : Error:Apex trigger RolllupSummaryOppAmt caused an unexpected exception, contact your administrator: RolllupSummaryOppAmt: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0016F00001tLWYSQA4; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trig_Demo_Update_Opp: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0066F00000n7Je2QAE; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, RolllupSummaryOppAmt: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0016F00001tLWYSQA4; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0016F00001tLWYS) is currently in trigger Trig_Demo_Update_Opp, therefore it cannot recursively update itself: [] Trigger.RolllupSummaryOppAmt: line 24, column 1: [] Trigger.Trig_Demo_Update_Opp: line 13, column 1: []: Trigger.RolllupSummaryOppAmt: line 24, column 1


Please give me the solution to this issue;

Regards
Lakshmi
Hi Dev's

trigger onecontactforoneaccount on Contact (before insert,before update) {

    if(Trigger.isInsert || Trigger.isUpdate){
        for(Contact con : Trigger.New){
            for(Contact c : [Select id,accountid from contact]){
                if(con.accountid == c.accountid && con.accountid != Trigger.oldmap.get(con.id).accountid){
                    Trigger.oldmap.get(con.id).addError('Duplicate account id');
                }
        }
        }
    }
}


Regards
Lakshmi
Hi Dev's,

I have a two objects Account and Contact
In account there is a custom field - contactscore__c
In contact there is a custom field - score__c
So, i want to calculate average value of all related contacts 'score__c'  and store the average value on account - 'contactscore__c' field;
How can we achieve this scenario using code?

Regards
Lakshmi.

Thanks in advance...