I’m experiencing an issue with this function where I want to parse in the next month as a query parm in a GET request. I’m tempted to say that this has previously worked, but I cannot say that with absolute certainty. Also feels strange that the error message (screenshot nr 2), is still referencing the old code commented out. Is this a bug in Appfarm, or is there something I’m missing?
Thank you for posting this issue to us. To double check, please could you verify the following:
If this error occurs in an environment which is not Develop, have you deployed the latest version to this environment where the issue is currently happening?
Is there possibly another place where this code could be referenced from, which is a different function to the one in the first screenshot, which could be outdated?
The issue is in Develop environment. Not yet deployed to test and tested there.
Nope. I have however done several changes since I posted this. Testing to see if I can figure it out.
To me it seems that there is some issues with the function evaluator in the query param on a webrequest action. I did experience a bug not to recent related to the function evaluator in the webrequest for the url. Might it be related?
I can see from the screenshot that the error message references “lastSundayPeriodeDate.getFullYear”, which is commented out in the Javascript code you provided. It could be that an old ‘version’ of the code exists still, if this is the only place where getFullYear is referenced. Maybe try duplicating this action node, and then removing the commented code in the new action node, and disabling the old action node?
This could possibly be a related problem yes, but it is hard to say for sure. The likely explanation is that there is another place where getFullYear is used, or that there is an old ‘version’ of the code, in which case the tip over can hopefully help.
Hi, done as you suggested and also edited the code somewhat in query param for the Webrequest action node. The error as changed but still an issue that needs to be sorted out.
Any other suggestions?
Since I found the issue I’ve adjusted the code, and this is now working. It should however work the exact same way using a datetime object from an appvariable, should it not?
Appfarm’s datetime property does not behave the same way as a Date() object created directly in the function editor. For example, the function getFullYear() cannot be run on an App Variable, or a DateTime property from somewhere else. This is why the error message was appearing for you earlier.
For manipulation and querying of dates that come from Appfarm data sources, it is recommended to use the library Moment.js. You can read more about it in Appfarm docs or the Moment.js docs