I have a custom meta data field called “date”. It is configured and formatted as “date” via the preferences>data tab.
The field is populated by some other script and I want to use the custom meta data from date to overwrite the “built-in” creation date. I built the following script
on performSmartRule(theRecords) tellapplicationid “DNtp” repeatwith thisRecord in theRecords set customMD to custom meta data of thisRecord set theDate to mddate of customMD set creation date of meta data of this_record to theDate endrepeat endtell end performSmartRule
However the script fails, even if I do not get any error message or the like.
There are two issues in the line setting the date, this revision should work:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with thisRecord in theRecords
set customMD to custom meta data of thisRecord
set theDate to mddate of customMD
set creation date of thisRecord to theDate
end repeat
end tell
end performSmartRule