I have…
- [x] Read the following guideline: https://docs.squidex.io/01-getting-started/installation/troubleshooting-and-support. I understand that my support request might get deleted if I do not follow the guideline.
I’m submitting a…
- [ ] Regression (a behavior that stopped working in a new release)
- [ ] Bug report
- [ ] Performance issue
- [x] Documentation issue or request
Current behavior
Trying to set a ‘Change’ script to fill in a ‘publishedDate’ and ‘archivedDate’. I’ve tried multiple versions of adding the date value to my Date Time field like (Tried separately of course)
data.publishedDate.iv = ctx.lastModified;
data.publishedDate.iv = new Date();
data.publishedDate.iv = new Date().toISOString();
Expected behavior
I would like to fill the field with the current date using the scripting utilities.
Minimal reproduction of the problem
Schema field
{
"name": "publishedDate",
"properties": {
"fieldType": "DateTime",
"editor": "DateTime",
"label": "Published Date",
"hints": "Date of first publishment"
},
"isDisabled": true,
"partitioning": "invariant"
},
Script:
if (ctx.status === "Published"){
var data = ctx.data;
data.publishedDate.iv = new Date().toISOString();
replace(data);
}
Environment
- [ ] Self hosted with docker
- [ ] Self hosted with IIS
- [ ] Self hosted with other version
- [x] Cloud version
Browser:
- [ ] Chrome (desktop)
- [ ] Chrome (Android)
- [ ] Chrome (iOS)
- [ ] Firefox
- [ ] Safari (desktop)
- [ ] Safari (iOS)
- [ ] IE
- [ ] Edge
- [x] Brave
Others:
I was able to set the property to null, as I received that value through my API call. So the script gets called, My guess is that my value is denied for a date time somehow.
It’s very difficult to debug this, and I find the documentation a bit lacking of the scripting.
I’m super thrilled to use Squidex and I love the platform!
Happy new year, as well!