Updating planned end date in Project Task is wiping Milestone value

Alex2506
Tera Expert

Hi,

We have a requirement when we're updating the planned end date on a project task, to copy that value to the planned start date. I've done this via a client script. 

 

However, if it's a Milestone task, the value in the tick box is getting removed. I think this is because the although the script is setting the date fine, the times are different. For example, the planned start date is set to 00:00:00 and the end date is 17:00:00. This is then setting the duration to 1. Which obviously isn't allowed on a milestone task. I've tried to force the time via the script but that doesn't work either. Can anyone help?

3 REPLIES 3

jameswoodfo
ServiceNow Employee
ServiceNow Employee

Hello, Alex,

 

I'm not sure I understand this requirement. However, a milestone task needs to a zero duration. So, to maintain it being a milestone task the start and end dates need to be the same.

Principal Technology Consultant, Expert Services, CTA/CIS+

Alex2506
Tera Expert

Hi @jameswoodfo - appreciate the reply.

So we'd like to be able to update the planned end date on a milestone task. When this is changed, copy that date to the planned start date. However, it's calculating these days as 1 day, thus setting the duration to 1. When I log the dates, it looks like it's setting the dates fine but the timestamp isn't the same. Screenshot attached.

So here I've updated the planned end date and my script has copied that to the start date. But the duration is showing as 1. Although the dates look the same, when I log them they've got different time stamps thus creating a duration.

AlexBracken_0-1747833001600.png

 

Alex2506
Tera Expert

Manage to grab it as the record was saving. You can see the time stamps getting added here '00:00:00 and 17:00:00'. If I'm copying the value in the planned end date field, why are the time stamps different. The time seems to be getting set from somewhere else

AlexBracken_0-1747834752257.png