0

Hello everyone i want to equal between reportname in custom object between report name in standard object

what is the problem here?

This is my query:

Select Id, Name, Report_ID__c, Attachment_Name__c, Email_Subject__c, Email_Body__c, Email_Recipients__c, Frequency__c, Weekly_Days__c, Monthly_Day__c, Last_Ran__c, reportname__c from Exporter__c
where reportname__c  in (select name.id from report)

This is my error:

where reportname__c in (select name.id from report) ^ ERROR at Row:2:Column:33 Didn't understand relationship 'name' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

Need help here with this query

Thank you very much.

  • Did you try (select id from report)? – m Peixoto Nov 2 '20 at 13:40
  • yes, it is not working – Tamir Nov 2 '20 at 14:06
  • Considering the field on Exporter__c is called reportname__c, it probably contains the name of a report, and not the id, so that's probably why it isn't working. Unfortunately, you cannot do subqueries like this on any other type of field, so you'd have to come up with a different solution. As m Peixoto said in his answer, you current query queries all report which isn't a good solution anyway. – rael_kid Nov 2 '20 at 15:18
  • Hi, welcome, before anything, please follow the How to ask guidelines, this questions is eligible for downvote or even delete. Now, directly to your question, try with just Name, and also take a look at this trailhead, and this other one. – AjFmO Nov 2 '20 at 20:01
0

I am not sure about all your environment. But the subquery is wrong:

Select Id, Name, Report_ID__c, Attachment_Name__c, Email_Subject__c, Email_Body__c, Email_Recipients__c, Frequency__c, Weekly_Days__c, Monthly_Day__c, Last_Ran__c, reportname__c 
from Exporter__c
where reportname__c  in (select id from report)

However, I suggest to review your query. I will query all reports. I am not sure if it make sense and could spend a time for that.

  • How do you know that the reportname__c field actually holds the Id of the reports? I think it should be name instead of id or name.id. – AjFmO Nov 2 '20 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.