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
AcademicHoboAcademicHobo 

Filtering a workflow via a polymorphic ID

I'd like to apply a workflow filter to an Activity based upon its value for WhatId or WhoId, but neither is available via the GUI.  I recognize that both are polymorphic, which imposes some limits.  But all I really want to do is manage my workflow based upon the types of SObjects WhatId and/or WhoId represent.  For that, I just need the first 3 characters of each Id (although a mapping to the actual SObject type would be nice too).  That way, for example, I could pass as outbound messages, only those activities related to Contacts or Accounts.  Is there a way to do this or am I just out of luck here?

 

- Cris

MrTheTylerMrTheTyler

two ways of doing this pop into my head. The first is to abandon using a workflow and just go with a trigger.  Second idea is to create a "Activity wrapper" custom object. This object would have to fields the first field would be a lookup to an activity object and the second field would be a string which identifies the first three characters of the what ID that the activity object references. So you would have an apex trigger which fires on the activity object and either creates a record or updates a record in the activity wrapper table. You could then use a workflow based upon the activity wrapper custom object.

 

 

~Tyler

AcademicHoboAcademicHobo

Tyler:

 

Thanks for the ideas.  Unfortunately, I am trying to do this without APEX at all.  I'd like to drop the workflow/outbound messaging tactic.  Ultimately I will take that approach.  I was hoping for a stopgap solution - maybe not realistic

 

- Cris