You need to sign in to do that
Don't have an account?
Forrest Muldune
Calculating date in Custom Object
All,
I am requesting for some assistance with a trigger I am trying to create within my custom object name Judgment_Event__c .
In the Judgment_Event__c I have the following fields below.
Action_Type__c (picklist)
Recording_Location__c (picklist)
Expiration_Date__c (date)
Recording_Date__c (date)
Years__c (Number)
In my Trigger when Action_Type__c = = ‘Recording’
And when Recording_Location__c = = ‘County’
When a user enters a value in the Years__c field, I would like the number to be automatically be added to the date in the Recording_Date__c and the final calculation will be automatically populated in the Expiration_Date__c. This will happens whenever a user creates a new record or edits the information.
Below are the coding that I have for now, it is not much since I am a beginner in Apex.
your help will be greatly appreciated.
I am requesting for some assistance with a trigger I am trying to create within my custom object name Judgment_Event__c .
In the Judgment_Event__c I have the following fields below.
Action_Type__c (picklist)
Recording_Location__c (picklist)
Expiration_Date__c (date)
Recording_Date__c (date)
Years__c (Number)
In my Trigger when Action_Type__c = = ‘Recording’
And when Recording_Location__c = = ‘County’
When a user enters a value in the Years__c field, I would like the number to be automatically be added to the date in the Recording_Date__c and the final calculation will be automatically populated in the Expiration_Date__c. This will happens whenever a user creates a new record or edits the information.
Below are the coding that I have for now, it is not much since I am a beginner in Apex.
your help will be greatly appreciated.
Try the above code and let me know, if it works for you
Thanks,
Karan
All Answers
Let take this example.
If the user enter value in the year field as 4, then recording date will be today(31-12-2014) and Expiration date will be (31-12-2018). Is my understanding is correct?
Thanks,
Karan
Yes it is,
if a user enter a date in the recording date field such as 1/4/2014 and then the user enters 4 in the Years field, then in the Expiration date field, the value will be 1/4/2018
thank you for clarifying this to me. I should wrote an example to you earlier
Try the above code and let me know, if it works for you
Thanks,
Karan
Thank you for your help on this . I really appreciate it. I am studying your code to know what updates you did to make this trigger works.
Do you know of any Apex trigger beginner tutorials I could learn from? I am looking for a real practical website for beginners.
Currently, I ordered this book http://www.amazon.com/gp/product/0596009208/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 so that I can learn Java as well.
Thanks.
Forrest
Happy learning and Happy New year :)
Thanks,
Karan
Happy New Year to you too. Thanks for the website and tips.
Regards,
Forrest