I want to add an integer field daysSinceProjectAccepted on project which should look something like this:
< field name=“daysSinceProjectAccepted” eval="(dateNow() - dateCreatedOn()).toDays()" /> // subtract the date today from date it was created and get the number of days.
The requirement you mentioned can be achieved using a domain field of type string. You can define it as a string field in the domain as follows:
<string name="daysSinceProjectAccepted" title="Project Acceptance Duration">
<![CDATA[
// Write your Java code here to process the value and return it. i.e difference of those two dates
return "";
]]>
</string>
By doing this, the value will be auto-processed when the record is saved.
If you have any further questions or need additional clarification, please let me know. Thank you.