Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Not able to update the DateTime field

(0) ShareShare
ReportReport
Posted on by 115

Hi,

I am trying to update a date time field with a date from another field through plugin.The behaviour of the fields is 'Date Only'. I am getting the error "String was not recognized as a valid DateTime".

Sample Code:

Contact contact = new Contact(){

contactId = {Guid of the contact to be updated}

startDate = account.startDate (I have field 'startDate' in Account and Contact entity both)

}

service.Update(contact)

Is there any other way to update the same through plugin?

Note: I can not use js or system workflow since I have some other things to do in plugin. 

Thanks

  • Suggested answer
    RE: Not able to update the DateTime field

    Hi MadhanSA,

    Yes, but I believe you have a small syntax error in there.

    Looking on the forum I found the following post with a similar question:

    https://community.dynamics.com/365/sales/f/dynamics-365-for-sales-forum/309818/update-datetime-using-plugin/897648

    There is  Convert.ToDateTime, you can try to see if it has the expected behaviour, or also you can try the formatting suggestions from there.

    Thank you,

    Madalina Toma

    Microsoft Support

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,313 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans