Challenge Overview
We lauched a challenge earlier on tagging and now we are in need of a generic component for tag any object.
Use Case Details
1. We have an existing functionality for tag an object, we want you to modify this functionality and make it generic for any sObject, so that user can use it for tag any object.Please watch this screencast to understand existing functionality.
2. As per current functionality we have a custom object Tag (CMC_Tag__c) for store data related to tag ( like tag name etc ).
3. We have implemented tagging functionality on an custom object “Issue(CMC_Issue__c)”.
4. We have a junction object called “CMC_Issue_Tag_Assignment__c” to store the relationship between “Issue” and “Tag”.
5. Right now we have override “Issue” detail page with a custom VF page, custom VF page display issue fields from the field set.
6. This VF page has an auto complete textbox that use to create tag, while typing on that text box if existing tag exists then user can choose that tag or can create a new tag, on save these tags copy into a textarea field ( Tags__c ) on issue object.
7. On save an trigger executed on issue object and insert/update the relationship and upsert records into “CMC_Issue_Tag_Assignment__c” object.
8.When any tag name updated then an trigger executed on Tag object and update the tags on related issues.
9. On delete on any tag, trigger will delete the tag from the issue and also delete the record from the “CMC_Issue_Tag_Assignment__c”.
10. If anyone delete the record from the “CMC_Issue_Tag_Assignment__c” object and that related tag is not associated with any other issue then we also delete the tag itself.
11. We have “Account Id” field on “Issue” , “Tag” and “Issue Tag Assignment” objects, while retrieving tags for the issue we display on the tag that filtered by the matching account id. For more detail review the existing code.
12. We need an generic functionality for tagging, we want a junction object that can store relationship for all object.
13. As per our idea when anybody needs to create tagging for any new object he/she can create a lookup field on that junction object for that object, the field name should be same as the lookup field API name.
14. We can identify this object in trigger and create record based on that in junction object.
15. We need a generic component that we can add in a visual force page or any inline page, in which we can pass object API name and field api name. That component should allow to suggest existing tag as autocomplete, allow to create new tag and allow to save selected tags on the object.
16. Component should be like this :
<c:ManageTag tagObject="MyObject__c" filterByField="Account_Id__c" create_option="true" create_option_text="Create new Tag" no_results_text="No results matched" availableTags="{!objIssue.Tags__c}" >
You can add additional parameters if needed.
17.Instead of using CMC_Issue_Tag_Assignment__c junction object create a new object CMC_Tags__c to store junction record.A text field on this object should indicate target sobject record id and a lookup field with Tag object(CMC_Tag__c) should be created to maintain relationship.Enhance trigger to work dynamically with any sobject and block duplicate junction record for same tag per sobject during update/insert.
18.Existing source code is shared in 'Source Code' thread.You should demo on 'Epic' object.
Final Submission Guidelines
1. Unit and System Testing. Unit tests, if any Apex Classes if must be developed as part of the challenge, above 90% coverage for all new classes written is required.
2. Code Aesthetics. Code must be clean (no commented code fragments, unused variables etc), tidy (4 space indents) and well commented. Use of Contest/Challenge names in comments instead of developer names. Utilising good clear and purposeful naming for variables, classes etc. Employ the use of Constants or enumerations where ever required. API methods should reside in the Service layer and not in the controller.
3. Data Volume - We need to make sure that the code built can process high volume of records.
4. Scalability - This solution is the first in the series of many, so we would like you to ensure this is designed with scalability in mind. The Code needs to be readable and maintainable.
5. Apex Code - Do not include any system.debug statements or any leftover code. Remove the variables that are not used. All the methods / variables defined, must be used somewhere in the code.
6. Video and Src Package - Please provide a demo video along with src package containing all artefacts.(An eclipse zip folder is fine, we don't need an unmanaged package)
7. Please complete all parts of requirements 1-17 before submitting the code.
8. Submission should tested as per the following use cases :
- While tagging an object, when user start typing in tag textbox, existing tag display only for the matching filter field ( like Account_Id__c ).
- When we create new tag, tag should be save in tagging object ( like issue__c ), in the Tag__c object and relationship should be save in the junction object.
- When we delete any tag from the "Tag" object, that tag should be removed from the tagging object ( like issue__c ) and from the junction object.
- If we update any tag name in "Tag" object then tag should be updated in the tagging object ( like issue__c ).
- If we delete any record from the junction object and assoicated tag is not related to any other record then also remove the Tag object record and also remove the tag reference from the tagging object as well.