function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Clap MasterClap Master 

Creating entitlement, entitlement process, and milestones in test code

I need to create test classes to do some stuff on cases, entitlements, entitlement processes, and milestones.  I understand that my case will map to an entitlement, and my entitlement maps to an entitlement process (SlaProcess), but I can't figure out how milestones connect to my entitlement process.  My cases get CaseMilestones based on entering the entitlement process, but where are the generic defined milestones that are supposed to be attached to the entitlement process?  

 

Anyone know?

Clap MasterClap Master

Thanks, but I've seen that already.  It doesn't show how a milestone directly relates to an entitlement process.

The_London_ScottThe_London_Scott
Yes I'm wondering about that curious gap in the ERD too. Since it looks as if I'll have several milestones for each entitlement process, and several entitlement processes, I"m already wanting to mass create milestones-in-entitlement-processes through the API, but it's not clear I can do that.
The_London_ScottThe_London_Scott
The mystery of milestones-in-entitlement-processes revealed: they are EntitlementProcessMilestoneItems and they are documented in the Metadata API under EntitlementProcess here (https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_entitlementprocess.htm?search_text=entitlement%20process).