API Questions on Kentico API.
Version 5.x > API > use current date time macro for default value of custome table filed View modes: 
User avatar
Member
Member
mj-y - 6/9/2013 6:34:55 AM
   
use current date time macro for default value of custome table filed
Hi
I want to use
{%currentdatetime%}
as default value for a custom table attribute. but it disappear just after hitting ok!
hint: my custom table has some data and I try above code in editing mode... all the items of this column are NULL.

Attribute properties:
Attribute name: AdDate
Attribute type: Date and time
Allow empty value: checked
attribute default value: ???????
time zone:inherit
Custom time zone: (none)
Display in editing mode: unchecked

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 6/10/2013 3:19:31 AM
   
RE:use current date time macro for default value of custome table filed
Hello,

Unfortunately macros are not resolved in this scenario (most probably due to some security aspects). I would recommend you to create a Data Handler which will be fired after ObjectEvents -> Insert, so after a new record will be inserted.

Best regards,
Martin Danko

User avatar
Member
Member
mj-y - 6/10/2013 5:27:12 AM
   
RE:use current date time macro for default value of custome table filed
thx for your solution,
I have used {%currentsite.siteid%} for one of my attributes and it works well! what is the difference?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 6/10/2013 7:04:48 AM
   
RE:use current date time macro for default value of custome table filed
Hi,

Just to confirm.. if you will try to use {%currentdatetime%} will it resolve in your case?
Which exact version of hotfix are you actually running?

Best regards,
Martin Danko

User avatar
Member
Member
mj-y - 6/12/2013 5:07:16 AM
   
RE:use current date time macro for default value of custome table filed
No it didn't solved my problem :( .
I used HotFix_55R2_44_net40.zip, is there any newer hotfix?

I found out that the problem is attribute type( datetime) , when I change it to (text) the macro saves...
Is that possible to use macro with datetime type?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 6/21/2013 2:34:33 AM
   
RE:use current date time macro for default value of custome table filed
Helllo,

Yes, you're right, unfortunately by the design of the application it's not possible to use the macros with datetime format in the current version, I will discuss it with our development team but I'm not pretty sure if it will be possible to change this functionality, it will be necessary to use text data type.

Best regards,
Martin Danko