• Admin 123
  • NEWBIE
  • 40 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 8
    Replies
Account and Contact Object have Lookup relationship.

The Requirement is:

ParentAccount: ABC has
Account1: Contact1, Contact2 (count of contact in account will display 2 in Account custom field)
ParentAcc: ABC has
Account2: Contact1, Contact2, Contact3(count of contact in account will display 3 in Account custom field)

But now In Parent Account(in its custom field): ABC Count Should Display as 5.

How can this be achieved through Apex code?
Account and Contact Object have Lookup relationship.
There are two requirements:

To display the count of Contacts into the Account Object.So I have created the trigger for it and now it is displaying the Contacts Count onto the custom field of Account Object.

Now the Second Requirement is: ParentAcc: ABC ,,,Account1: Contact1, Contact2 (count will display 2 in Account custom field) ParentAcc: ABC,,,Account2: Contact1, Contact2, Contact3(count will display 3 in Account custom field)
But now In Parent Account: ABC Count Should Display as 5.

How can we achieve this??
Can we put the logic for the CREATE PDF button wherein this button should only be available when opportunity.status=Approved? ​ Thanks in Advance.
I have this functionality, wherein once I click on new button, it will need to choose specific record type, once I choose, I want my lookup field to be default logged in user?User-added image


How will be the trigger for it?

I have written Apex code as::

trigger Update_Field on my_object (after insert) {
     //user defaultuser = [select id from user where name = 'default user'];
     for (my_objec C:trigger.new) {
        if(C.VTM_Name__c==null) { 
         C.VTM_Name__c= userinfo.getUserId();    
         }
  }
}

but I am still not getting the default value as logged in user.
Is it possible within SFDC to identify which reports are using a specific object? I would like to obsolete the reports but don’t know how to identify short of looking up each individual report
upsert failed on ship to insert transaction: duplicate value found: Legacy_System_Id__c duplicates value on record with id: 001C000001aktGT
what is this error?
And the account information fields are not updating into Salesforce.com correctly.
For this, I checked all the triggers, Classes, rules and I found nothing about the field that is not updating.
Even I checked in dev Console if there's any duplicate id, But only one row i got.
What might be the reason? Please help.
Now I created new page having sections of Account and Task and created two buttons and now the conditions are " if you click on Save with task button it should create record in account and display in related list (Open Activities) and if you click on Save Without task button it should create Account record but not Task (Open Activities) record."

How will I achieve this functionality?
 
 The logic is when we create Customer Project(Custom obj) for an Opportunity(Standard obj) with the Status=Active(Picklist value), then Active Customer project check box on the Opportunity detail page is automatically checked.
wherein there is lookup between Customer Project and Opportunity..!
 
trigger UpdateSA on Task (before insert,before update)
 { for(Task t: Trigger.new)
    {  If (t.Date_Time_Denied__c == null ||    t.Declined_By__c == null)
        {
           t.SA_Denied__c = true;
        } else
            {            
               t.SA_Denied__c = false;  
      }  
    }
    Test class for this?
 The logic is when we create Customer Project(Custom obj) for an Opportunity(Standard obj) with the Status=Active(Picklist value), then Active Customer project check box on the Opportunity detail page is automatically checked.
wherein there is lookup between Customer Project and Opportunity..!
 
Account and Contact Object have Lookup relationship.

The Requirement is:

ParentAccount: ABC has
Account1: Contact1, Contact2 (count of contact in account will display 2 in Account custom field)
ParentAcc: ABC has
Account2: Contact1, Contact2, Contact3(count of contact in account will display 3 in Account custom field)

But now In Parent Account(in its custom field): ABC Count Should Display as 5.

How can this be achieved through Apex code?
Now I created new page having sections of Account and Task and created two buttons and now the conditions are " if you click on Save with task button it should create record in account and display in related list (Open Activities) and if you click on Save Without task button it should create Account record but not Task (Open Activities) record."

How will I achieve this functionality?
 
 The logic is when we create Customer Project(Custom obj) for an Opportunity(Standard obj) with the Status=Active(Picklist value), then Active Customer project check box on the Opportunity detail page is automatically checked.
wherein there is lookup between Customer Project and Opportunity..!
 
trigger UpdateSA on Task (before insert,before update)
 { for(Task t: Trigger.new)
    {  If (t.Date_Time_Denied__c == null ||    t.Declined_By__c == null)
        {
           t.SA_Denied__c = true;
        } else
            {            
               t.SA_Denied__c = false;  
      }  
    }
    Test class for this?

I want to change the pick list value (Open,Inprogress,Hold,Complete) the default value is open . when i click a button or link  ask one meaasge are you sure want to complete? Y/N, click Y means,  the picklist value to change (open to complete), also enable the check box is true.?

 

Any suggestion is helpful..