• Pranav Mandlik 16
  • 0 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 1
I am new to salesforce i am writing trigger test class, i want to create task under account but after execution of this trigger is passes the test but task is not creating under account i have written test code for a trigger
Account account      = [select Id,ownerId from Account limit 1];

            Task t       = new Task();
            t.whatId     = account.Id;
            t.subject    = 'Email';
            t.OwnerId    = account.ownerId;
            t.status     = 'In progress';
            t.priority   = 'Normal';
            insert t;      

            String type = [select Id,Type from task where Id =:t.Id].type;
            system.assertEquals('Email', type);

the task is not creating under that account i dont know whats the problem
please share any ideas over this
Hello all i am new to salesforce
I have following requirement,

Update Activity “Type” field with following:
Type = Call, if Subject starts with "Call" case-insensitive.
Type = Email, if Subject starts with "Email" case-insensitive.
Type = Task, for other Subject.
Type = Meeting, for all Events.
i have only one confusion that do i need to write 2 triggers for this like one for task and one for event
My Requirement is:
There is custom field "Activity Score" on Contact and Account, which should be updated based on following formula:

Contact/Account Activity Score =
Count of Meetings * 3 + Count of calls * 2 + Count of Emails * 1

(Note: This count will be done for all child activities)

Can anyone help??