2

I am looking to export events and tasks from one organisation to another for all account records with a specific recordtype.

Is there a way I can query tasks and events which are related to accounts with a specific recordtype? This would include opportunities as well whose account recordtype will also be of specific recordtype.

1
  • Isn't any demonstrated effort required? This is just a work order. Commented Jun 9, 2019 at 0:23

1 Answer 1

8

You're in luck: you don't have to wait until Summer '19 hits your org, bringing with it Polymorphic SOQL, or use a subquery on WhatId, because you can query through the non-polymorphic AccountId relationship on the Task and Event objects:

SELECT Id FROM Task WHERE Account.RecordType.DeveloperName = 'My_Record_Type'

Opportunities don't have any polymorphic relationships, so they're no more than an ordinary relationship query:

SELECT Id FROM Opportunity WHERE Account.RecordType.DeveloperName = 'My_Record_Type'
1
  • Really.. That's so exciting to hear.
    – Prady
    Commented Jun 8, 2019 at 16:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .