tag:blogger.com,1999:blog-4535447606986422873.post3296449646006220315..comments2024-03-29T03:13:40.498-07:00Comments on MSCRM Shop: Check if the date is a business day in CRM2011Anonymoushttp://www.blogger.com/profile/04193418105246403607noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-4535447606986422873.post-67534453494410911332013-11-03T04:56:35.492-08:002013-11-03T04:56:35.492-08:00Check the serverURI in app.config is exactly sam...Check the serverURI in app.config is exactly same as defined in the deployment manager.Anonymoushttps://www.blogger.com/profile/04193418105246403607noreply@blogger.comtag:blogger.com,1999:blog-4535447606986422873.post-64835225857723195192013-11-01T10:53:48.378-07:002013-11-01T10:53:48.378-07:00I am trying to paste app.config values but it is n...I am trying to paste app.config values but it is not publishing. I have used testcrmserver\aniJoshi as userID and testpwd is the password (they are correct windows logins). DeviceID and Devicepassword is the same as from your code.Anonymoushttps://www.blogger.com/profile/00818286689015419491noreply@blogger.comtag:blogger.com,1999:blog-4535447606986422873.post-68975721269695597922013-11-01T10:52:05.108-07:002013-11-01T10:52:05.108-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/00818286689015419491noreply@blogger.comtag:blogger.com,1999:blog-4535447606986422873.post-50647354035074137732013-11-01T10:50:07.209-07:002013-11-01T10:50:07.209-07:00Hello Mr. Singh
Thanks for the nice blog. I tried...Hello Mr. Singh<br /><br />Thanks for the nice blog. I tried the code and get 'access denied' error while stepping through the below line<br />EntityCollection calendars = service.RetrieveMultiple(query);<br /><br />App.config has following defiiation and username/password is valid windows login. Don't know what should be the value for DeviceId/DevicePassword.<br /><br /><br /><br />Below are the exception details.<br /><br />Server stack trace: <br /> at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)<br /> at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)<br /> at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)<br /> at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)<br /> at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)<br /> at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)<br /><br />Exception rethrown at [0]: <br /> at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)<br /> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)<br /> at Microsoft.Xrm.Sdk.IOrganizationService.RetrieveMultiple(QueryBase query)<br /> at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultipleCore(QueryBase query)<br /> at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultiple(QueryBase query)<br /> at Microsoft.Xrm.Client.Services.OrganizationService.<>c__DisplayClass22.b__21(IOrganizationService s)<br /> at Microsoft.Xrm.Client.Services.OrganizationService.InnerOrganizationService.UsingService[TResult](Func`2 action)<br /> at Microsoft.Xrm.Client.Services.OrganizationService.RetrieveMultiple(QueryBase query)<br /> at TESTCRM.Program.CheckHolidays(DateTime date) in c:\Projects\CRM\TESTCRM\TESTCRM\Program.cs:line 57<br /> at TESTCRM.Program.Main(String[] args) in c:\Projects\CRM\TESTCRM\TESTCRM\Program.cs:line 26<br /> at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)<br /> at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br /> at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br /> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br /> at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)<br /> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)<br /> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br /> at System.Threading.ThreadHelper.ThreadStart()<br />Anonymoushttps://www.blogger.com/profile/00818286689015419491noreply@blogger.comtag:blogger.com,1999:blog-4535447606986422873.post-11363998946810627292012-08-22T19:20:11.179-07:002012-08-22T19:20:11.179-07:00I thought the author (Amreek) was trying to convey...I thought the author (Amreek) was trying to convey a point rather than giving us a lesson about LINQ. I guess Amreek you have managed to successfully explain how to retrieve the holiday list from CRM and it is up to us to follow any convention we like. I'd still stick to the old lovely For Loop as I don't see that much harm/difference anyway.<br /><br />On the other hand and if you (coder) really want to use LINQ anyway, then you may need to consider a more readable LINQ query so it can be easily understood and interpreted (as well as less conversion and shorter syntax). Your code should be:<br /><br />return calendarrule.Entities<br />.Any(e => ((DateTime)e["starttime"]).Date == date.Date);<br /><br />In your version of the code... you are saying for a list of calendar rule entities, retrieve me a list of entities that their startdate == date.Date and then return true if this list has any value.<br /><br />My version of the code... I'm saying for a list of calendar rule entities, return true if any of the records has a startdate == date.Date<br /><br />Thanks Amreek.... your post is really great as usual.<br /><br />Ethrahttps://www.blogger.com/profile/13602179241259186876noreply@blogger.comtag:blogger.com,1999:blog-4535447606986422873.post-19999465451627040312012-08-14T06:45:34.695-07:002012-08-14T06:45:34.695-07:00Thanks for the feedback buddy. The code is written...Thanks for the feedback buddy. The code is written by a Ist year uni student. I believe that he did a good job for a student.<br /><br />Anyway you missed a bracket after date.Date.<br /><br />I do appreciate the feedback and updated the code.<br /><br />Thanks again.Anonymoushttps://www.blogger.com/profile/04193418105246403607noreply@blogger.comtag:blogger.com,1999:blog-4535447606986422873.post-76333317899656162392012-08-14T03:54:44.092-07:002012-08-14T03:54:44.092-07:00While you're there, use some linq, rather than...While you're there, use some linq, rather than the loop at the bottom.<br /><br />return calendarrule.Entities<br /> .Where(e => ((DateTime) e["starttime"]).Date == date.Date<br /> .Any()coderhttps://www.blogger.com/profile/18027747672185866077noreply@blogger.com