Good day.
I am having a problem with a function that used to work before.
This is the error I get on Console:
And this is the code that is executed:
Part 1
Part2
Whats troubling me is the error is on property hourOut, but I am not trying to update or change this property. I am working in 2 data tables. 1: employees - does not have the property hourOut and never had. Table 2: dailyHours which does have the hourOut property, but I`m not trying to change it in the code being executed. Disabling the save object block, the last block, does take away the error. But for obvious reason that cant be a permanent solution.
Please help!!
Hello @Frans_Fourie
Could you please create an empty page and add a button component which on click runs only the function. It allows us to check exactly this function in the isolated env.
Regards, Vlad
Hello @vladimir-upirov
Thank you for your reply.
I have done that and tested, getting same problem.
App ID: 26535B9F-121B-48A8-ACC2-7F6D4F01A455
Page: test
Thanks for that
The error comes from the server when you save a dailyHours
object
{"code":0,"message":"Cannot read property 'hourOut' of null","errorData":{}}
So, I checked your Cloud Code and I can see you’ve got an afterUpdate
event handler for the dailyHours
table and it seems like the Response Item
block contains nothing
I’m still investigating it
@vladimir-upirov
Thanx for that.
If its any help, i was busy yesterday and one of the google chrome tabs froze for no apparent reason. I was busy on a different page. When I reloaded the tab the page kept on giving me a script error. Refreshed tab again, still the same. Closed chrome completely and reopened then all of a sudden the page was working again. To my knowledge the internet connection was stable throughout. Dont know if that’ll help at all, just giving all the info I can. Because the page that the jceAndShiftHours function is called from was also open at that point in time. Not sure if that froze aswell or not
I just found in the logs that the server could not save the object because of:
Validation for the 'shiftHours' property failed. Property value does not match the required pattern.
That’s the reason why the Response Item
is empty, but the Response Error
gives you the error above
I assume you should add a condition on the top of the Cloud Code logic or use Request Item
block instead
@Frans_Fourie
please let us know if you still need any assistance
@vladimir-upirov
Thank you for that. I’ll check it as soon as I can, and give you feedback.
Thank you for your time and assistance
@vladimir-upirov
Thank you for your assistance. I am still learning how to code in general. It was a stupid mistake on my side, some functionality that I did not know about. It was a picklist validation that stopped the record from processing. Validation for the 'shiftHours' property failed. Property value does not match the required pattern.
If I could ask one more thing please. Can I see this log where you got this info from - Validation for the 'shiftHours' property failed. Property value does not match the required pattern.
on my side?
Once again, thank you
You can get that error using the Response Error
context block