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
Andrew McGrathAndrew McGrath 

SOQL - Attachments Parent ID not coming through

Hi

When I run a query on attachments to pull their parent id, it works fine for eg Accounts:

Select id, parent.id from Attachment
where parent.type = 'Account'

However for Tasks I get only a 'null parent' return:

select id, parent.id from attachment
where parent.type = 'Task'

Does anyone have the answer to this or a workaround?

Cheers, 

Andy
Best Answer chosen by Andrew McGrath
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
select id, parentId from attachment
where parent.type = 'Task'

All Answers

sfdcsushilsfdcsushil
Check this

https://success.salesforce.com/ideaView?id=08730000000isD3AAI
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
select id, parentId from attachment
where parent.type = 'Task'
This was selected as the best answer
Andrew McGrathAndrew McGrath
Thanks both! @Bhaswanthnaga that worked great.