You need to sign in to do that
Don't have an account?
AichaSF
Apex Month Name
Hello,
I have an insert in an object A (with two dates). After the insertion of the object A, an insertion of an object B will be done in such a way that:
- The number of records inserted is equal to the number of months between the two dates.
- The field Name of the object B is equal Month name + Year.
Can someone help me.
I have an insert in an object A (with two dates). After the insertion of the object A, an insertion of an object B will be done in such a way that:
- The number of records inserted is equal to the number of months between the two dates.
- The field Name of the object B is equal Month name + Year.
Can someone help me.
1) Validate whether both dates are present and in case of any future validations.
2) Use "monthsBetween" method provided by salesforce to find the number of months.
3) now use a for loop to insert the number of records.
Let me know if this helps. Happy to provide code snippet if you stuck somewhere in the process.