Below is a example script for an Enter State milestone.
How do I script a Leave State Milestone? Please note I have tried the line below and it does not work.
milestone.milestoneType = 'LEAVE';
var milestone = item.addMilestone(); milestone.setWorkflowState('Short name'); milestone.milestoneType = 'ENTER'; milestone.milestoneDate = new Date(); milestone.warnThreshold = 10; milestone.progress = 50;
Solved! Go to Solution.
The two values for milestones.milestoneType are ENTER and EXIT.
You can find the relevant scripting reference in the wiki here: Scripting Reference