简体   繁体   中英

Two table Salesforce SOQL query

I'm new to Salesforce and was given a query to write between two tables. I need your help. There are two objects Task(fields - Task TID, Task Name) and Task Hier(Task TID, Task Name and Project ID).

How to get all the Project IDs using SOQL when the user selects the Task Name in VF page, from that name get the Task TID of Task Object and then go to Task Hier table matching Task TID and get all the Project IDs matching the Task ID and display.

I'm not that good at SQL. Any help in this matter is really appreciated.

Thanks Chaitra

From your description in your question, it would appear that you already have all the required fields on the "Task Hier" object and don't need to join to the Task object.

  1. Task Name for the SOQL where clause
  2. Task TID
  3. Project ID

If this isn't the case, can you expand the question out with the API names of the fields and objects required? The custom objects and fields will have API names ending with __c.

To get the task id you would use something like this: task__c.Id because your task object is a custom Id then it uses __c at the end however the Id is a standard field therefore it does not need __c. also you can use force.com Explorer to see the output of executed SOQL queries before using them in your system. https://developer.salesforce.com/page/ForceExplorer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM