Use relationships to associate an object with other objects in Salesforce.

learn more… | top users | synonyms

2
votes
2answers
26 views

Is it possible to get the “type” of object you're querying in a SOQL relationship query

For example, in the standard Salesforce Event object, I'd like to do the following with the WhatId field. select what.name, what.type(?) from event where id = 'myid' However, this will only work if ...
0
votes
1answer
21 views

Help with formula field needed

The population of ABC fields depends on field__r.Account__r.Name field. I want to assigned ABC formula field with field__r.Account__r.Name value if field__r.field__c is blank, but if there are some ...
2
votes
1answer
36 views

Are lookup fields on the User object (e.g. to Contact) supported by the platform?

Aim – i need to have a lookup field on the user object which looks @ the contact object and only returns values where the email address is @domain.com Now i am under the impression that no lookups ...
2
votes
0answers
47 views

What is the logic for the automatic creation and update of custom report types?

It seems there is a lot of magic behind custom report types. For example, if I create a new master detail field to the account object for "Custom" a new report type "Accounts w/Custom" is created ...
2
votes
2answers
24 views

Do I have to manually call an update in a trigger for an object the trigger is NOT on?

I've noticed in triggers it is not necessary to use CRUD calls as it is in apex classes. However if I am updating a field on a different object to the one the trigger is on, do I need to do it then? ...
1
vote
1answer
48 views

Need Help on Cross Object Look Up Field Update

I finally have the Ids query corrected(after 20 years); Select (Select ParentA__c From ChildA__r) From ParentB s WHERE Id IN (Select s.ParentB From ChildB s) I now have the IDs I would need to ...
2
votes
1answer
86 views

Relationship between Account and Opportunity and Account and Contact

On Opportunity there is a lookup relationship to Account.But why it behaves as Master-Detail as we can create Rollup Summary Fields on Account. Similarly if we delete Account then Contact gets ...
2
votes
1answer
14 views

How to view inbound relationships

Working with a very large and complex salesforce setup, we have a custom object with several lookup fields to external objects. These are easy to check. I was hoping there would be an easy way to ...
1
vote
2answers
89 views

Related Object Fields in custom button (URL Hack)

Having a real brain freeze here. I am using some URL hacking to auto fill some fields on a custom object. USE CASE I have a custom object 'Operations Action' that is related to a case. My Case ...
0
votes
1answer
26 views

Selfrelationship of account

How to define self relationship in salesforce explain how can i create self relationship in salesforce. I know salesforce doesn't provide out of the box this relationship. My Scenario is i have a ...
0
votes
1answer
27 views

Understanding ChildRelationship object

I am using the C# web-service to get data from salesforce, After calling the "sforceService.describeSObjects()" function, I am running on the object and get they ChildRelationships. For example, I ...
1
vote
1answer
38 views

Is it possible to use SObject Formula fields to get arbitrary values stored in some other SObject?

Let's say I have some SObject (myCode__c) with three string values (e.g. key1__c, key2__c, and code__c). The combination of key1__c and key2__c should be unique. Let's say I have a second SObject ...
1
vote
1answer
126 views

How to default parent fields when displaying new child object VF page

I have created a custom lookup field on the Order object to the Opportunity because we want to create Orders from Opps and not Accounts. I have also created a Visualforce page for Orders and am ...
2
votes
1answer
70 views

Better way to fetch a User field from the a record's ownership?

Sorry if this has been asked before, but I feel that there has to be a simpler way to get a User field from the Owner relationship. I'm currently looping through 2 lists and then mapping the objects ...
2
votes
2answers
169 views

How do I return Manager name instead of ManagerID in a SOQL query?

I am running the following query: SELECT Name, ManagerID FROM User The result yields a User's name and their corresponding Manager's user ID. How can I return the Manager's name instead of the ID ...
1
vote
3answers
115 views

Error counting Child records

I have a parent object Feedback that has multiple Feedback_Comments as child(lookup). I have counted total Feedbacks grouping by name. But I'm unable to count the childs grouping by name. Here's what ...
4
votes
2answers
180 views

SOQL Outer Join Multi Level Master Detail Relationship

I am working with a 3 Level Master Detail Object Relationship: "Level 1" has "Level 2" detail records "Level 2" has "Level 3" detail records I am trying to Query "Level 1 records" and using an ...
1
vote
1answer
126 views

How to link Single Contact to Multiple Account?

How can we link single contact to multiple Account. I have seen many links related to this issue but couldn't get any idea. Is there any work around for creating multiple Account for single Contact. ...
1
vote
1answer
61 views

Is it possible to automate junction object creation?

Example use case: I have three objects: Order, Item, and OrderItem. OrderItem is the junction object that relates Orders to Items (because an Order can have many Items) and Item to Order (because an ...
1
vote
2answers
58 views

Trigger to update grandchild records

How do I update a grandchild's field if there is a change in grandparent field? I know I have to write a trigger because its cross object I can access the immediate child record of parent which is ...
1
vote
1answer
314 views

Accessing child records in visualforce

I have an object Feedback_Comment__c which lookups to Feedback__c. How can I access "Feedback_Comment__c" fields in a datatable column? I could pull all Feedback__c fields like this... ...
3
votes
2answers
183 views

Cannot access owner fields in new instance of child object even though OwnerId is populated

I have CustomObject__c that has the standard Owner field (which is a lookup field to a User). My code is the following: User myUser; //assume I've populated myUser as a result of a SOQL query or ...
3
votes
1answer
108 views

activity aggregate relationships only allow security evaluation for non-admin users when a single parent record is evaluated

I am getting the following error when I run a Salesforce SOQL query with a standard account. Query: SELECT ( SELECT Id, Subject FROM OpenActivities ORDER BY ActivityDate ASC , LastModifiedDate DESC ...
1
vote
1answer
56 views

How do I insert a list of related line items in apex?

I am creating a visualforce page and a custom apex class for a page that allows users to convert opportunities and opportunity line items into service contracts and contract line items. I've got all ...
3
votes
1answer
114 views

Relationship Query to Get All Events Associated with Account

I have the following query that works for getting all the Tasks and Events for a Lead. [SELECT ID, activity_count__c, (SELECT ID FROM Tasks WHERE Status = 'Completed'), (SELECT ID FROM Events) FROM ...
2
votes
0answers
73 views

Problems querying on KnowledgeArticle related objects

I'm trying to issue some SOQL which will return a KnowledgeArticle along with it's KnowledgeArticleVersion, ViewStats, and VoteStats. According to the Knowledge data model I should be able to do this ...
3
votes
1answer
45 views

Task Relationship Issue

I know that task is associated to a custom object by using the "WhatID". I need a filter based on if the task exists or not. For example parent__c and task: [select id, (select id from tasks) from ...
4
votes
1answer
104 views

DescribeSObjectResult contains fields of type reference with an unknown relationship name

I use the SOAP API (WSC, partner wsdl) to describe objects and use the field meta information to dynamically build SOQL queries. Today i observed that DescribeSObjectResult can contain fields of type ...
3
votes
3answers
87 views

SOQL - How to obtain Parent Name of CombinedAttachments

I am unable to obtain the Name of a Parent object, where the child is CombinedAttachments. The SOQL I use is listed below and works as expected. Select (Select Id, Title, RecordType, ...
3
votes
2answers
172 views

No master-detail relationship in which the User or Lead objects are the master?

Why can't we create a master-detail relationship in which the User or Lead objects are the master, any particular reason?
4
votes
3answers
492 views

Difference between __c and __r?

I read this article for difference between __r and __c. But I still can't understand how is Hiring_Manager__c.Email will be different from Hiring_Manager__r.Email Can anyone explain this? Thanks ...
4
votes
6answers
1k views

Relationship between account and contact

I checked 'Account Name' field in Contact object. It appeared as a Lookup(Account). But when I deleted that account, contact also got deleted which tells me it is a master-detail relation. Can anyone ...
4
votes
1answer
634 views

Difference between a self relationship and Lookup relationship

With Self relationship you can reference the same object, at the same time you can create a lookup relationship and still refer to the same object. So when do you call a relationship as self vs ...
1
vote
1answer
95 views

SOQL to get SmallPhotoURL

I am trying to create a custom VF page that shows records from my standalone custom object in a list along with the picture of the user who created that record..like this (User's image is hardcoded ...
2
votes
2answers
172 views

How to find accounts with no child accounts using soql?

I have requirement where i need to process account which has no child but has parent and accounts which has no parent and child separately. I tried select id, name,(select id, name from Accounts) ...
2
votes
2answers
1k views

SOQL Subquery - Standard Parent, Custom Child

Can someone help me understand why Im unable to execute the following query? Is it something obvious? Custom_Object__c has a lookup relationship to Contact. select Id, (select Name from ...
4
votes
1answer
90 views

Triggering code on sObject Child Relationship actions

I have a scenario in which I would like to fire off some Apex functionality when an Attachment is inserted from an EmailMessage object (that is received via Email-to-case). The trouble is, it does ...
2
votes
1answer
201 views

trigger to update lookup fields in 2 object lookup fields

trigger to update lookup fields in 2 object lookup fields My requirement is : a) i am having 2 lookup fields in 2 different objects with fields with common fields "city" If i update a city using ...
0
votes
2answers
323 views

How to set reference Object's value before insert?

Object a has many of object b, How can I determine an object reference before insert ? When I determine object b information for example number, name, .. and I want to insert it to an object of ...
0
votes
2answers
325 views

How can reference a custom object to a Opportunity object?

I have a custom object named Order, its fields same with Opportunity and I set lookup between them, what I need is when I create an Order record, a related Opportunity record is also be created ...
3
votes
2answers
747 views

Junction object fields

I have created a many to many relationship between two objects, A and B, using a junction object. That works fine, and the related lists show up on A and B with standard layout pages. Is it possible ...
1
vote
2answers
267 views

How to add multiple entries into a related list?

I have 2 custom objects: Package and item. Each package can have multiple items, and I know that when I create a new package. I tried to have a lookup field on package to display items. - But that's ...
3
votes
1answer
272 views

Join Custom object with regular object

I'm very new with Salesforce. I've been reading this page trying to figure out how to do joins. All the objects were created before I jumped on this project. I have one custom object called : ...
5
votes
2answers
538 views

Accounts with many-to-many relationship with accounts — how to create a report on contacts

I'm setting up an org that has a many-to-many relationship between "buyers" and "sellers." I'm using the Account object for both buyers and sellers and set the Type field picklist to have the choices ...
2
votes
1answer
377 views

Related Custom List With Order and Inline Editing - Many to Many relationship and Junction Object

We are using three objects in this project: Contact (for authors), Paper, and junction object PaperAuthor. Paper holds all all attributes to describe an academic paper. Paper can have many Authors. ...
8
votes
1answer
2k views

SObject row was retrieved via SOQL without querying the requested field:

I am getting this error with the code below. I've looked into the other cases on here. In my case I am referring to a relationship name (__r) which I am assuming is pulling correctly. It's a field ...
10
votes
2answers
476 views

Do child/parent relationship names need to be unique?

Don't all child relationship names on an object need to be unique ? I know they need to be unique if it's a relationship name on a parent to child relationship, but I thought they still needed to be ...
1
vote
1answer
1k views

Parent and Parent.Id with custom objects

I am attempting to adapt some code which was originallly written to work off of an Account object to now work on a custom object. Part of the code is referring to the Parent Account of whichever ...
2
votes
3answers
527 views

SOQL relationship name syntax error

I want to return the account name for each task in a SOQL query, am I correct in saying the relationship is that the Account is the parent object and the Task is the child object? I am not sure who to ...
4
votes
1answer
581 views

How to retrieve a value from a parent field with SOQL via partner API in java

I have a parent-child relationship with timesheets relating to users. I am trying to retrieve an Employment ID field from the parent record with SOQL and this is my query, where the UserID is a field ...