You need to sign in to do that
Don't have an account?

Business Hours
Hey all,
Try to compile the following in an APEX controller class for a VF page:
Code:
BusinessHours bh = [Select b.FridayEnd from BusinessHours b where b.Id='01m0000000000GLAAY'];
This query works in the Apex Explorer no problem. When I try to compile it in APEX it gives me the following error:
Error: Compile Error: No such column 'FridayEnd' on entity 'BusinessHours'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names
So is there an issue with the BusinessHours table in APEX???
Any help or insight would be much appreciated!
Thanks
Dave
b.FridayEndTime
Also in APEx there is no need to use the letter dot notation. I feel it just clogs up the code.
Message Edited by TehNrd on 09-03-2008 10:44 AM
Thanks a million for the reply, greatly appreciated BUT (and there's always a but!)
I added Time to the end of it, and it compiled, which brought me on to the next problem. I tried to assign the value to a string but got an error saying: "Data type not supported."
I looked up the Enterprise WSDL then, as I assume that is where you got the fact that the field is called FridayEndTime. I see that the data type is actually something called "Time", which is also a listed primitive for apex. So now I have this in the code:
This still throws the "Data type not supported" error.
Bottom line here is that it doesn't seem that APEX supports this? Any further ideas?
Davser wrote:
Thanks a million for the reply, greatly appreciated BUT (and there's always a but!)
I added Time to the end of it, and it compiled, which brought me on to the next problem. I tried to assign the value to a string but got an error saying: "Data type not supported."
I looked up the Enterprise WSDL then, as I assume that is where you got the fact that the field is called FridayEndTime. I see that the data type is actually something called "Time", which is also a listed primitive for apex. So now I have this in the code:
This still throws the "Data type not supported" error.
Bottom line here is that it doesn't seem that APEX supports this? Any further ideas?
Your right in the Time is a little unique. When you tried to convert it to a string was this your syntax:
String timeValue = String.valueOf(bh.FridayEndTime);
Well, I was actually trying to display it on screen via an outputField element.
However I tried to use your suggested String.valueOf syntax, with no luck. Still getting the Data type not supported error!
As soon as i try to reference that field from the businesshours object the error is thrown.
Integer hour = bh.FridayEndTime.hour();
I would take this up with salesforce.com support if you can.
Message Edited by TehNrd on 09-03-2008 11:52 AM