I got requirement to get Date for next weekday based on the weekday index input
For example if you need to check what the date on next Monday is, As obvious I created two workflow input variables and wrote logic to get next weekday date.
But I found the custom workflow not working because of the because of the datetime form issue.
What I did, fist I changed CrmDateTime to DateTime and then manipulated DateTime to get next date and converted DateTime to back CrmDateTime.
But because of the usertime not available in datetime, my workflow was going on waiting mode.
I tried lot’s things to get it done and finally I got it working like this
CrmDateTime _CrmTest = CrmTypes.CreateCrmDateTimeFromUniversal(_DateTimeVariable.ToUniversalTime());
Hope it can help somebody 🙂