Resetting a DateTime-field with invalid data, programmatically - c#-4.0

In Dynamics CRM 365:
I'm coding a plugin for a workflow, that's supposed to set a DateTime-field to a given date. The code works fine, unless the field ALREADY contains the value '31-12-9999'.
Every time I try to Update the entity's field with a new DateTime-value I get the following error:
The date-time format for 9999-12-31T23:59:59-00:00 is invalid, or value is outside the supported range.
The format isn't a problem, seeing as it works fine with any other date. I know for a fact the problem is because of the 31-12-9999 in UTC.
As soon as I try to access the field, it tries to convert it to GMT+2 (local timezone) and fails.
The question:
Is there a way to force delete/update the value in a field through a coded plugin?
I have tried with the normal organizationservice CRUD-operations but none of them work.

This should help or give ideas
https://community.dynamics.com/crm/f/117/t/237525
"the date format used for those fetch conditions has to match the date format configured for that user in CRM"

Related

Access VBA: Date function not working

I have a button on a form that displays the current date. Very simple code:
MsgBox DATE
This worked for several months, but after some seemingly unrelated changes this stopped working and I get the error: run-time error '2465': Can't find the field "DATE' referred to in your expression.
Clearly, Access stopped recognizing DATE as a function, and is trying to find it as an object that doesn't exist. DATE() is immediately replaced by DATE by Access in the VBA code.
None of the objects in the form are named Date and none of the fields in the control source table have the name Date so I don't know why Access is confused.
When I create a new form with a button and the same code it works. Any ideas?
Try this:
MsgBox VBA.Date
It should point Access to the VBA built-in function instead of some field called DATE.
Date is a data type ... use the Now method

Orchard CMS Query Creation Date

I'm new to Orchard CMS and trying to create a query that will filter a list of upcoming events date. What I want to do is filter a list of upcoming events. I have set up a list and plan to use the creation date (setting the date to the event date) as filter. Where I have ran into an issue is getting the filter value to work. When I set the filter value to {DateTimeField.Date} for get the current date or any of the other date options, the filter does not work. It show all events. When I manually type in the value field "2014-08-20", it works. Any ideas of why I can not set the date to the current date?
I have also tried creating just a date field within the content definition and received the same issue as above. I do plan to create a Event End Date that will not show, but will be used to filter. I assume the value will be very similar though to what would be needed for the creation date though.
I am using Orchard CMS 1.8.0
Any help will be greatly appreciated.
The current date can be obtained in Token form like this: {Date}. That token itself can be modified as a date token. In particular, it can be formatted. In your case, because the filter will construct a HQL filtering clause from your expression, {Date.Format:yyyy-MM-dd} will put the current date into the right format.

Cannot get the list schema column property from SharePoint list?

I am getting this error inconsistently while working with Excel table connected to a SharePoint list. Similar issue has been reported on TechNet and it indicates it could be due to certain column types such as Date and Time, Lookup, or Calculated ... I would like to know when and why exactly this happens? What's more interesting is the error is not consistent, it just happens randomly.
Thanks in advance.
MOSS 2007 on Windows Server 2003 x86 Standard Edition
In my case I exported the list into Access and made some changes which I synched with Sharepoint afterwords.
I found the solution under List Settings > Change Column:
As I exported the List in excel, I saw the error message "Cannot get the list schema column property from SharePoint list". However excel was able to read the data from Sharepoint but two columns were missing.
The problem was that the columns with a date format (Not date and time, only date), had "Today's Date" as default value initially. After the synch, the default value was changed into the manual input option below "Today's Date". After I changed the default value back to "Today's Date" the problem was gone. So it was a problem about incoherent cell value and default value. This could also happen in different cell types.
I was debugging this same issue just recently. I ran into a lot of explanations that an update had changed the default value for the Date columns. Solutions presented were to set a new, real default value, save, then clear it out again. Others suggested converting to Text and converting back.
In my case I was able to identify the column was not a Date field but a Lookup field. I was pulling my hair until I ran across this blog post. It mentioned this problem could happen with Lookup columns which pull data from Calculated columns. That's exactly what my problem was. Except it worked when it was first created. It wasn't until after a user accidentally deleted the Lookup column and we recreated it. That's when the trouble started.
Interestingly we have another Lookup column bound to the same list to a different calculated column but it does not trigger the error.
I did a more thorough write-up and explanation on my own blog detailing the steps we went through until we solved it.
In my case, the solution was to check the data pulled by a lookup column. After i selected the value in the lookup column, i pulled also other column data related to that value. The secondary column of the lookup contained some weird characters "#&" . After removing it, the export worked.
With office 2013 there was no problem even with the special characters.

How to get the Current Date & Time Automatically to a Date Time Field

I have created a date time field I made today's date as the default value, Then I added it to a page layout and created a page, But the current Date Time is not picking up from the system.
I dont want to give the user to select a Date Time instead it should populated automatically
Is there anyway to achieve this without writing code in code behind files?
This is very similar to this question I think
SO - How to get Date and current time from the Date/Time column in SharePoint Custom list
My answer there gives a few options such as using the built in Created field, using a calendar template, a JavaScript hack and a custom field type.
Guys, fake [Today] trick worked for us - but prob is we only got the date value not datetime.
Janis, is it possible to get date and time both from the fake [today] column trick? pls refer few articles on the same
Does [Today] work?
If you have language pack applied to SharePoint, then you must use localized "Today" string.

Modx assign default date to template variable

I have a template variable of input type date but I'd like to have a default value of the current date at the time the document was first saved.
I've noticed that using the date formatter widget gives an option to "If no value, use current date" however it seems to use the date at the time it is being viewed rather than the date at the time the document was created.
Any help appreciated.
I think the only way to get the date when the article was saved for the first time is to use [ * createdon * ]
If there is a way to add the created date to a TV, I am not sure. I think your best shot would be to see if you have an event that you could "hook" you Template Variable, and then use the createdon variable everytime the article is saved! I am not sure this works, but This could be a possible!

Resources