Challenge Overview
Functional Requirements
��
Check In Procedures: When button is tapped for the first time, it should call a javascript/jquery method that uses two global variables:
��
1. ��checkIn.currentUser - Salesforce Id for a User record
2. ��checkIn.currentRecord - Salesforce Id for a record that we will be attaching the Activity to. This code should work for any object Id. For demo purposes, please use a Contact Id. ��
3. ��checkIn.description - Text to pass to the Activity record
4. ��These can be hard-coded values for now (currentUser and currentRecord)
5. ��This method should call Apex RemoteAction that creates an Activity record for that user (currentUser) and ���Related To��� (api name: WhatId) equals currentRecord. ��
6. ��It should stamp the Activity.StartDateTime field in the Activity with the current Date/Time (now).
7. ��Activity.Subject should be set to checkIn.description
8. ��It should return the Activity Id to the Javascript and store it in a global variable named checkIn.currentActivity.
9. ��VALIDATION: only 1 activity can be active at a time (only 1 checkin). ��Therefore, before attempting to create an Activity (when the button is tapped), we need to check if there is already an ���open��� Activity.
�� 9.1 ��If the checkIn.currentActivity != null, show an alert box to the user saying ���[currentRecord.Name] is currently checked in. ��Do you want to check out?��� ��with a Yes button and a No button. ��
�� 9.2 ��If the Yes button is tapped, then follow the Check Out Procedures below for that currentActivity before doing Check In Procedures for new currentRecord. ��
�� 9.3 ��If they tap the No button, then cancel the check In
��
Check Out Procedures: When the button is ���un-pressed��� it should do the following:
��
10. ��pass the checkIn.currentActivity from JS to a remoteAction Apex method that queries that Activity. ��It should then update the Activity.EndDateTime = current date/time.
11. ��When completed, set currentActivity = null and currentRecord = null.
��
��
Technical Requirements
��
12. ��This should be an HTML5 component, optimized for the iPad, but usuable as a web-based component on any mobile device (only testing with iPad is necessary).
13. ��Built as a VF component. Please add any css or javascript into the same VF Component as the button so it is an all encompassing component.
14. ��jQuery used for the client-side logic and the jquery method calls Apex Remote Actions to create the Activity and to edit/close the Activity
��