Salesforce APEX triggers to measure Account activities
€30-250 EUR
Completed
Posted over 9 years ago
€30-250 EUR
Paid on delivery
Pear the object Account, the following fields have to be created:
1) number_of_next_activities__c
2) next_activity_date__c
3) number_of_past_activities__c
4) number_of_past_calls__c
Behaviour
1)
The field number_of_next_activities__c has to ALWAYS include a number that is the sum of:
- the number of TASKS that are with status=NOT COMPLETED
- the number of EVENTS that are with date=in the future
2)
The field next_activity_date__c has to ALWAYS include the date/time of the next soonest activity which:
- is a TASK and is NOT COMPLETED
- OR is and EVENT and is in the FUTURE
3)
The field number_of_past_activities__c has to ALWAYS include a number that is the sum of:
- the number of TASKS that are with status=COMPLETED
- the number of EVENTS that are with date=in the past
4)
The field number_of_past_activities__c has to ALWAYS include a number that is the sum of:
- the number of TASKS that are with status=COMPLETED and include the word "call" in the subject
- the number of EVENTS that are with date=in the past and include the word "call" in the subject
A trigger should be executed every time a change on a TASK happen (change of status, change of date, change of subject, change of related account/lead/object)
A trigger should be executed every time a change on an EVENT happen (change of date, change of subject, change of related account/lead/object) OR when it moves from the future to the past as time passes (at the time of the event).
bulk changes have to be supported.
100% coverage is required.
TEST CASES:
A) account TESTACCOUNT is created. It has no activity. The values must be:
- number_of_next_activities__c 0
- next_activity_date__c BLANK
- number_of_past_activities__c 0
- number_of_past_calls__c 0
B) an activity TASKA is created with date=tomorrow, subject=sendemail status=not started.
- number_of_next_activities__c 1
- next_activity_date__c tomorrow
- number_of_past_activities__c 0
- number_of_past_calls__c 0
C) the task TASKA is set as COMPLETED
- number_of_next_activities__c 0
- next_activity_date__c BLANK
- number_of_past_activities__c 1
- number_of_past_calls__c 0
D) the task TASKA is updated changing subject from sendemail to docall
- number_of_next_activities__c 0
- next_activity_date__c BLANK
- number_of_past_activities__c 1
- number_of_past_calls__c 1
E) an event EVENTA is create with date=tomorrow, subject=callmark
- number_of_next_activities__c 1
- next_activity_date__c tomorrow
- number_of_past_activities__c 1
- number_of_past_calls__c 1
F) a task TASKB is created with date=dayaftertomorrow, subject=calljohn
- number_of_next_activities__c 2
- next_activity_date__c tomorrow
- number_of_past_activities__c 1
- number_of_past_calls__c 1
G) EVENTA is moved from tomorrow to yesterday
- number_of_next_activities__c 1
- next_activity_date__c dayaftertomorrow
- number_of_past_activities__c 2
- number_of_past_calls__c 2
Hi,
Sebastiano, clearly described, I can have it for Monday, fully tested and with movie.
Actually I think that in the last behavior you have repeated a previous one. I believe that you meant number_of_future_activities__c