tag:blogger.com,1999:blog-7233186359690994418.post252747607418363851..comments2023-04-07T16:52:30.185+03:00Comments on Freelance Development for Dynamics CRM: Formatting datetime in workflows with custom workflow activity in Microsoft Dynamics CRM 4.0Anonymoushttp://www.blogger.com/profile/03225186683208658482noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-7233186359690994418.post-34637437750771830672012-07-18T14:34:39.583+03:002012-07-18T14:34:39.583+03:00edit: "using Microsoft.Xrm.Sdk.Query;" c...edit: "using Microsoft.Xrm.Sdk.Query;" can be left outAnonymoushttps://www.blogger.com/profile/02813598444745717181noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-53235791879249905012012-07-18T14:32:10.459+03:002012-07-18T14:32:10.459+03:00I took the liberty to update the code to .net4 for...I took the liberty to update the code to .net4 for use with CRM 2011.<br /><br />Kind regards, Vincent Pannenborg<br /><br />using System;<br />using System.Activities;<br />using System.Collections.Generic;<br />using System.Globalization;<br />using System.Text;<br />using Microsoft.Xrm.Sdk;<br />using Microsoft.Xrm.Sdk.Query;<br />using Microsoft.Xrm.Sdk.Workflow;<br /><br />namespace FormatDateTime2011<br />{<br /> public sealed class DateTimeHandler : CodeActivity<br /> {<br /> // Input property<br /> [RequiredArgument]<br /> [Input("Format of DateTime")]<br /> public InArgument InputDateFormat { get; set; }<br /><br /> // Input property<br /> [RequiredArgument]<br /> [Input("DateTime to format")]<br /> public InArgument InputDateTime { get; set; }<br /><br /> // Output property<br /> [Output("Formatted DateTime")]<br /> public OutArgument OutputResult { get; set; }<br /><br /> protected override void Execute(CodeActivityContext executionContext)<br /> {<br /> string DateFormat = InputDateFormat.Get(executionContext);<br /> DateTime datetime = InputDateTime.Get(executionContext).ToLocalTime();<br /> string result = string.Empty;<br /><br /> CultureInfo provider = CultureInfo.InvariantCulture;<br /><br /> if (!string.IsNullOrEmpty(DateFormat) && datetime != null)<br /> {<br /> result = datetime.ToString(DateFormat, provider);<br /> }<br /><br /> OutputResult.Set(executionContext, result);<br /> }<br /> }<br />}Anonymoushttps://www.blogger.com/profile/02813598444745717181noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-69025118730418457562012-04-06T22:20:28.038+03:002012-04-06T22:20:28.038+03:00Hello Richard,
I believe it is possible but you wi...Hello Richard,<br />I believe it is possible but you will have to redevelop your code and use other DateTime.ToString method which retrieves format and IFormatProvider parameters - http://msdn.microsoft.com/en-us/library/8tfzyc64.aspx In this provider you can set French locale.Anonymoushttps://www.blogger.com/profile/03225186683208658482noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-84679113517545074902012-04-06T21:40:54.958+03:002012-04-06T21:40:54.958+03:00Is there a way to return the french when I use the...Is there a way to return the french when I use the MMMM (Month name) or ?Richardhttps://www.blogger.com/profile/03563380829044489478noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-57605756435047192812011-05-23T15:38:43.065+03:002011-05-23T15:38:43.065+03:00Hello Jack,
You can see sample here - http://1.bp....Hello Jack,<br />You can see sample here - http://1.bp.blogspot.com/_73OmG38HHME/TBlT30eujxI/AAAAAAAAAmg/ZCibtud_J-Y/s1600/DateFormat3.JPG<br /><br />One quick note - mm - will return minutes. To set months you should use MM instead of mm.Anonymoushttps://www.blogger.com/profile/03225186683208658482noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-15566288068763770162011-05-23T12:44:24.335+03:002011-05-23T12:44:24.335+03:00Hi Andriy,
It was a .net framework issue, i got t...Hi Andriy,<br /><br />It was a .net framework issue, i got the plugin registered now. What inputs can the "Format of datetime" condition in the workflow take? dd/mm didnt seem to workf for me!Jack Yazhttps://www.blogger.com/profile/08230500624036628345noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-15926750055618796582011-05-19T13:15:20.736+03:002011-05-19T13:15:20.736+03:00Hello Jack,
I assume that you have problems with ...Hello Jack,<br /><br />I assume that you have problems with .Net framework. What versions do you have installed?Anonymoushttps://www.blogger.com/profile/03225186683208658482noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-69078149090282317272011-05-19T12:35:32.442+03:002011-05-19T12:35:32.442+03:00Hi there,
I'm getting the following error on ...Hi there,<br /><br />I'm getting the following error on registration<br /><br />Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.<br /> at System.Reflection.Assembly._GetExportedTypes()<br /> at System.Reflection.Assembly.GetExportedTypes()<br /> at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)<br /> at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)<br /> at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)<br /> at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)<br /><br /><br />Any idea whats wrong?Jack Yazhttps://www.blogger.com/profile/08230500624036628345noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-88465331434888125682011-02-03T10:52:58.694+02:002011-02-03T10:52:58.694+02:00Hello. Here is text description how to register cu...Hello. Here is text description how to register custom workflow activities - http://msdn.microsoft.com/en-us/library/ee704600.aspx<br /><br />If you will have other question - don't hesitate to ask.Anonymoushttps://www.blogger.com/profile/03225186683208658482noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-62204748735931737602011-02-02T00:21:55.723+02:002011-02-02T00:21:55.723+02:00PS.
I forgot to ask: Do you have a guide on how to...PS.<br />I forgot to ask: Do you have a guide on how to register this plugin or plugin in general? And by the way, don't seem to find compiled assembly here in blog?Quercushttps://www.blogger.com/profile/04259917726447366730noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-67399529709160699962011-02-01T23:58:39.627+02:002011-02-01T23:58:39.627+02:00Hi Andriy
This is just what I needed! Greate work!...Hi Andriy<br />This is just what I needed! Greate work!<br />But I'm not sure how to register this with CRM Plugin Registration Tool 2.2. I'm connected to CRM server and trying to follow the tools guide on how to register plugin. But what to fill in??<br />Best regards,<br />HenrikQuercushttps://www.blogger.com/profile/04259917726447366730noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-35191816230878083952010-10-28T01:31:52.836+03:002010-10-28T01:31:52.836+03:00Hello, Deene.
In this case you should build code ...Hello, Deene.<br /><br />In this case you should build code proposed in the article and install the library using pluginregistrator. This will give you additional possibility in workflows - to format datetime fields as you want.<br /><br />If you have questions you can drop me an email. You can find my address in my profile.Anonymoushttps://www.blogger.com/profile/03225186683208658482noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-69343047189767204122010-10-27T23:58:56.362+03:002010-10-27T23:58:56.362+03:00Hi,
I would like to do something similar. I am tr...Hi,<br /><br />I would like to do something similar. I am trying to remove the time from a datetime attribute in an email created by a workflow. Even though the attribute is set to "Date Only", in my email created by the workflow, the time is displayed after the date.Deenehttps://www.blogger.com/profile/17644468395966453345noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-90556713449338134942010-09-21T23:50:04.812+03:002010-09-21T23:50:04.812+03:00Hello, Brenden. Actually C# is placed on a blog as...Hello, Brenden. Actually C# is placed on a blog as a sample what and how can be done in CRM. You can just download compiled version of assembly at the end of post and register it on your system using PluginRegistration tool.Anonymoushttps://www.blogger.com/profile/03225186683208658482noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-30261723200131388012010-09-21T20:26:02.460+03:002010-09-21T20:26:02.460+03:00Andriy - can you tell me where your C# code goes o...Andriy - can you tell me where your C# code goes or how you have compiled it? The solution is great and I'd like to implement it but not sure about the custom code.Unknownhttps://www.blogger.com/profile/01651894134100585312noreply@blogger.comtag:blogger.com,1999:blog-7233186359690994418.post-15449900058917635752010-07-14T13:19:05.791+03:002010-07-14T13:19:05.791+03:00Works Great! Thanks a lot Andriy! You've ma...Works Great! Thanks a lot Andriy! You've made my users very happy!Dutchhttps://www.blogger.com/profile/04307239738989738473noreply@blogger.com