[SalesForce] Trying to rewrite Milestone target date to Case field

In our company we work on cases. Cases have milestones, based on Entitlements. Entitlements are based on Entitlement Processes (EP). EPs define target dates for each milestones. One of the milestones is initial response. Target date varies, depending on customer, product, priority etc.

I'm trying to implement automatic response, if response is not earlier sent manually.

Regular auto-response cannot be delayed. So I'm trying to use time based workflow.

Time based workflow gives me the chance to use after and before time triggers. I'm interested in before time trigger, which can be relied to any date/time case field, e.g. 'send an email 1 hour before Case: Initial Resoponse Target Date'.
But this must be case field. Now this date is defined as milestone target date. So I'm thinking about rewriting milestone target date to case field.

I tried case APEX triggers. I have some code prepared by someone else years ago. Using it I was able to rewrite milestone target dates, but only during case update, not creation. Trigger is defined as beforeInsert and beforeUpdate though.
I assume that:

  • I completely don't understand APEX triggers 🙂
  • milestones are created only after case is created, that's why I cannot rewrite target date on 'before insert' trigger.

Now I'm considering if after insert and after update trigger should be used.

Please just let me know if my approach is OK or this is dead end.

I checked also workflow rules, but it looks like from workflow rules there is no access to milestones dates. So I cannot rewrite them to case.

Best Answer

You can not update TargetDate and most of the other fields on CaseMilestone as these are not writable fields.

According to the SOAP API Developer Guide, the only fields which allow update are Start Date and Complete Date.

Related Topic