How can I set a DateTime value into an exAttribute through CustomSchema?
Overview
If you are trying to store a DateTime value in an exAttribute using DateStringProperty, this will not work as expected for ex attributes.
The reason is that DateStringProperty is not currently supported on ex attributes. It expects an AD attribute definition in ConnectorSchema, which causes an exception internally. That exception is handled silently, so the value does not save and no obvious error is returned.
Why the Current Schema Does Not Work
The following schema definition is not supported for ex attributes:
Although the script can read the value as a DateTime, assigning it back to the exAttribute in this way will not persist correctly.
Recommended Options
Option 1: Store the value as a string
Store the date as a string and parse it whenever you need to use it.
This is the safest and recommended approach.
Option 2: Use the syntax attribute
Try defining the property with the syntax attribute set to Date Time instead:
This may be a suitable alternative depending on how the attribute is being used.
Option 3: Custom script parsing
Modify the Active Directory script logic to parse your chosen date format string and return a DateTime object.
This is an advanced option and should be approached with caution, as incorrect changes can have wider system impact.
Example of the Original Script
Summary
- DateStringProperty is not currently supported on ex attributes.
- The failure is caused by the property expecting an AD attribute definition in ConnectorSchema.
- The exception is handled internally, so it does not appear as a visible error.
- The safest option is to store the value as a string and parse it when needed.
- An alternative is to define the property using syntax="Date Time".
- Custom script-based parsing is possible, but it is an advanced approach.