Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Getting date from Week number and day

Posted on by 45

I have two fields in CRM representing a day of the week (day spelled out in text) and week of the month (numeric value 1-4). Getting curent year is not a problem. The idea is to represent a very specific day of each month we will perform an action.

I want to turn that into a date value and update a separate date field each month with the correct date for that particular month. I have hit a wall so here I am asking for an assist :-).

I have played around with calculated date fields and the various workflow utilities and have not been able to accomplish much.

Any ideas?

*This post is locked for comments

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Getting date from Week number and day

    Yes, let us know if you go for plugin and needs any help.

  • jenks540 Profile Picture
    jenks540 45 on at
    RE: Getting date from Week number and day

    I think you are right. I would not mind changing things slightly to "third Wednesday of the month" but i still don't think I can achieve without custom code. I was hoping I was missing something with the various workflow utilities.

    thanks to you both.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Getting date from Week number and day

    Hi,

    I don't think you will be able to get anything out of box or any utility to achieve this. You will need to write your own custom code (plugin/ JavaScript etc) to get the date out of this.  

    Hope this helps.

  • jenks540 Profile Picture
    jenks540 45 on at
    RE: Getting date from Week number and day

    Yes, of course. But, will go there as a last resort. Would prefer to keep this in CRM if possible. Thanks

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Getting date from Week number and day

    Hi jenks540,

    You will still be able to make use of SQL Server Agent Jobs if you have SQL Server Management Studio (SSMS) and SQL Server Integration Services (SSIS).

  • jenks540 Profile Picture
    jenks540 45 on at
    RE: Getting date from Week number and day

    This is CRM online - so, no access to SQL Agent jobs

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Getting date from Week number and day

    Hi jenk540,

    I was under the impression that you only wanted to execute the logic once.

    Consider executing your logic from a reoccurring SQL Server Agent Job instead of directly from Dynamics CRM. By customising a SQL Server Agent job, you can choose the particular days you want to run your logic.

  • jenks540 Profile Picture
    jenks540 45 on at
    RE: Getting date from Week number and day

    Thanks for the reply.

    I am not seeing how I could make sure something is executed on say, "Wedensday of the third week of every month" with that method. Can you elaborate a little bit? Thank you!

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Getting date from Week number and day

    Hi jenks540,

    It think it is a better idea to create a single date field and compare the date field to the current date on a regular basis. Then execute your logic when the date field exceeds the current date.

    I think it is important to point out that there are typically more than four weeks in a month, and there are other reasons why your text approach will create unnecessary complexity.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans