I have been struggling a little bit to come up with a template and form that I can recycle the code on to reuse for future ones.
Basically almost all tables in DNN have some common columns that are used through out the application used for auditing purposes
These include:
ModuleID
PortalID
UserID
CreatedOnDate
CreatedByUserID
LastModifiedOnDate
LastModifiedByUserID
I have figured out how to get some of this data looking through the forums and at other examples.
For instances
<SelectCommand CommandText="SELECT @uid AS UserID">
<Parameter Name="uid" Value='[[User:ID]]' DataType="Int32" />
Will get the USERID from DNN and allow you to save it to the corresponding column. I am sure this same technique can be used for the other ID fields as well.
However when I get to the date fields things tend to get a little muddy for me.
I was able to add [LastModifiedOnDate]=GETDATE() to the <SubmitCommand> line of the form to save the date but I was confused on how to do the create on date. Considering this is the Add/Update form I dont know how to separate the two so it knows the difference from modified and new record when inserting the data.
Sure I can go ahead and create a default value in SQL for that column to GETDATE() however I would rather use the DNN token of [DateTime:Now]. However this doesn't seem to work when I have tried to use it. I would prefer to get the time stamp from DNN with my timezone instead of the server time since its a shared hosting plan on GoDaddy.
It just seem that xmod would be easier to use if some of this stuff was covered a bit better after you go though the tutorials of how to make your templates and or forms videos. Or this should be part of the wizard on the forms, temples, and table builder that can be toggled so that the can implemented quickly.