• Ritesh Gupta 27
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 0
    Questions
  • 5
    Replies
hi,
In vf page there are few records and i need to click on the "id" the record and it must redirect to the record detail page.


Please lt me know how to achieve this
  • August 24, 2015
  • Like
  • 0
Hi all,
Can we export custom labels(names) and values to excel?


Thanks,
venkat.
Hi please any one help me on this " I am trying to update Account related Opportunities ". Here I have a field on Account object named as "Account Status" and also i have field on Opportunity Object named as "Opportunity Status". if changed Account status as "Active " then the Account related Opportunities "Opportunity Status" also "Active", if the Account status is changed to "In Active " then the Account related Opportunities "Opportunity Status" also changed to " In Active". this is my requirement. below is my code. when i use this code am getting error like "Error:Apex trigger updateAccRelatedOpptys caused an unexpected exception, contact your administrator: updateAccRelatedOpptys: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0069000000cAZjEAAW; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateAccCon: execution of AfterUpdate caused by: System.ListException: Duplicate id in list: 0019000001Eu0chAAB Trigger.UpdateAccCon: line 16, column 1: []: Trigger.updateAccRelatedOpptys: line 15, column 1"

Below is my code. please let me explain how to avoid this error. when i use same code for account related contacts and cases update its working fine.


trigger updateAccRelatedOpptys on Account (After insert,After update) {
//set<>
list<Account> accRelConts=[select id,name,Account_Status__c,(select id,name,Oppty_Status__c from Opportunities) from Account where id IN : trigger.newMap.keyset()];
list<Account> accrelOppty=[select id,name,Account_Status__c,(select id,name,Oppty_Status__c from Opportunities ) from Account where Id IN : trigger.newMap.keyset()];

System.debug('++++++++++key set+++++++++++'+trigger.newMap.keyset());
list<Opportunity> opplst=new list<Opportunity>();
for(Account a:accRelConts){
for(Opportunity op:a.Opportunities){
op.Oppty_Status__c='hjg';
opplst.add(op);
}
}
if(opplst.size() > 0){
update opplst;
}
}
Hello friends,
    Here is my code.where i first fetch the max value and using that max value trying to fetch one row.but unable to do so because it needs object to string conversion.
[i tried--->> String s=code.toString(); //not working.]
 AggregateResult[] groupedResults=[select MAX(Agent_ID__c)maxvalue from Mobile_Agent__c];
      Code = groupedResults[0].get('maxvalue');
      TableData=[select Name,Last_Name__c,Device_Phone__c,Subscriber_ID__c,Agent_ID__c,registered_date__c from Mobile_Agent__c where Agent_ID__c='Code'];
Hello friends,
    Here is my code.where i first fetch the max value and using that max value trying to fetch one row.but unable to do so because it needs object to string conversion.
[i tried--->> String s=code.toString(); //not working.]
 AggregateResult[] groupedResults=[select MAX(Agent_ID__c)maxvalue from Mobile_Agent__c];
      Code = groupedResults[0].get('maxvalue');
      TableData=[select Name,Last_Name__c,Device_Phone__c,Subscriber_ID__c,Agent_ID__c,registered_date__c from Mobile_Agent__c where Agent_ID__c='Code'];

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.