[SalesForce] Why Cant we access the `MilestoneStatus` field either on the `Workflow` or `Process Builder` or in `formula` field

Why Cant we access the MilestoneStatus field either on the Workflow or Process Builder or in formula field ?

As per current implementation, my Case Detailed page is pure custom and I have Entitlement Processes and Milestones in place. The thing is that I cant access the Milestone Status Icon field, but I can access the MilestoneStatus value. That value I need to populate into Custom Milestone Status Icon and using formula field I wants to show the Milestone Status Icon.

How can I approach to this implementation ?

I got the reference here : https://help.salesforce.com/articleView?id=000171150&language=en_US&type=1

But how can I populate custom picklist field if I dont have access to Milestone Status field using Workflow, PB etc?

Note: I have almost 5 Milestones on each entitlement processes and almost 40 Entitlement Processes. I only need to used OOTB MilestoneStatus which gets calculate the value automatically that value I wants to populate to different field and formula field will just show the correct Icon.

Can we implement using Queueable interface?

Best Answer

As it's explained in the Knowledge Article Case.MileStonestatus is a very special field, populated and treated differently as most other fields in Salesforce. Schema reports the field as String(30).

Even if it is displayed in Setup, in my tests (Execute Anonymous Context) it seems not to be accessible by Apex

Case c = new Case();
c.Subject='test';
c.MilestoneStatus = 'test';
insert c;

Variable does not exist: MilestoneStatus

Nor is it available in SOQL queries

[ select Id, MilestoneStatus from Case limit 1 ]

No such column 'MilestoneStatus' on entity 'Case'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

So implementing the Queueable interface is unlikely to work.

The Knowledge Article recommends

Workaround:

Have a picklist field (e.g. Status or a custom picklist field) that can be populated dynamically basing on the Milestone Status Value. After having the picklist field, create a formula field that will set the value same as the Milestone Status basing on the Picklist value that has been set.

Example: If your case status = abc and this is the criteria for milestone a, then you code your formula field to return a value of milestone a if the status = abc.

Now my interpretation of this is that you are encouraged to implement an independent formula field which is mimicking the result of MilestoneStatus. But like you I find this workaround worded not very clearly and hard to understand. Salesforce should have provided a real example with the actual code of the formula to avoid misunderstandings and guesswork.

Related Topic