You need to sign in to do that
Don't have an account?
Rohan Chadha
Kindly help with the code.
Write trigger to prevent Duplicate records entered by user and it should prevent the bulkyfication
Hi All,
I am new to salesforce and have requirment to prevent user to create duplicate record and it should work for bulkyfication as well.
Please find the screenshot bellow of the Ticket Object detail page. The requirement is that there should be validation if user try to create duplicate records for same(Customer,username,email-id) and withing the period of Start date & End Date.
- You can create the duplicate records if the start date & End date is before or after the existing record.
- Key Values to check duplicacy is Username, Customer and Email Id.
- It should support bulkyfication.
Kindly help with the code.
I would suggest the following approach.
1) Create a field named Formula__c on this Tickit__c object which will sumup all the values. You may need to search a little about concerting date into text but however, try to grab all the required fields text values into Foirmul__c field.
Your final output of text field can look like this:L Formula = NYC Concert John Smith John@gmail.com John@gmail.com 25 3/20/2018 3/21/2018
You can of course eliminate some of the fields if you like based on your requirements as well.
2) Make a use of below trigger:
Hope this helps and if this solves the query then please mark is as best answer!
Thanks for your quick response.
I tried to progress on this and wrote the below the code. but i am failing to put condition on End Date and Start Date.
-->I want to apply condition that user cannot create duplicate Ticket if the Start date or End date lying the in the existing record.
for ex- if u have this entry in your DB
->NYC Concert John Smith John@gmail.com John@gmail.com 25 3/20/2018 3/25/2018
Now you tried to Enter below. It Should Fail
->NYC Concert John Smith John@gmail.com John@gmail.com 25 3/21/2018 3/25/2018 Fail
->NYC Concert John Smith John@gmail.com John@gmail.com 25 3/23/2018 3/28/2018 Fail
->NYC Concert John Smith John@gmail.com John@gmail.com 25 3/26/2018 3/27/2018 Pass
->NYC Concert John Smith John@gmail.com John@gmail.com 25 3/18/2018 3/19/2018 Pass
Kindly help