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
Robert Wambold 10Robert Wambold 10 

In SOQL...select id, whatid from task where WHAT.TYPE = 'Opportunity', Is there an alternative to WHAT.TYPE in APEX.

In SOQL...select id, whatid from task where WHAT.TYPE = 'Opportunity'.

Is there an alternative to WHAT.TYPE in APEX.

Best Answer chosen by Robert Wambold 10
ApuroopApuroop
Only since you have asked for an alternative...

Create a Formula field, let's say WhatIdForSOQL:
Data Type: Formula
Return Type: Text
Syntax:
WhatId
Your new SOQL:
SELECT Id, WhatId FROM Task WHERE WhatIdForSOQL__c LIKE '006%'