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

learn more… | top users | synonyms

1
vote
1answer
32 views

Before Insert: Using __r to pull related data in a Trigger.New for loop results in nulls even though lookup relationship has Id

Situation: I am trying to build a custom validation rule via apex that will stop users from saving a charge item to a quote if the charge item exceeds the available product quantity. The charge ...
1
vote
2answers
36 views

What type of object is the Event.Owner property?

I am struggling to understand the nuances of related fields. In my VF page for Events, I can access properties of the event owner like so: Event.Owner.Name, and Event.Owner.Type. Because of this, I ...
1
vote
1answer
25 views

How to SOQL query a Filtered Lookup on same Object?

I am trying to a subQuery for records of a specific Opportunity type that lookup via a Filtered Lookup, 'parent' Opportunities of another record type. This is the latest subquery tried so far: ...
1
vote
2answers
37 views

Relationships data not return when on UnitTest

I have been looking all over for a solution. What i have seen in other similar issues online is the error was related to code errors/user errors. I have looked over my code several times and cant see ...
1
vote
1answer
58 views

How to create an object with n number of children mapped to it

I have a requirement in which I have a parent and which could be related to n number of child, and all the child can have only single parent. What to do if I want to achieve this. If I do this ...
0
votes
2answers
31 views

Retrieving Dynamic SOQL results. Runtime error - “Invalid field Owner.Name for…”

I had a question in regards to dynamically retrieving the results of Dynamic SOQL that I have set up in my controller. I want to be able to access fields on the Lead object (Lead.Name) itself as well ...
0
votes
1answer
22 views

Parent-child query returns Aggregate Query Exception

I am getting all the contacts for the account and wanted to load it in a map Reference : Map<string, decimal> mapcol = new Map<string, decimal>(); for(Account acc : select id, (select ...
1
vote
2answers
31 views

Display History tracking section in visualforce standardcontroller

I am using standard controller of a custom object called Enagements__c to display details of the record in VF Page. I want to use the standard feature of '<apex:relatedlist' and display all the ...
2
votes
1answer
43 views

Multiple upsert: Creating Parent and Child Records in a Single Statement Using Foreign Keys

The following is my Apex class to upsert the below input into salesforce. INPUT {"req" : { "tickets": [ {"External_TicketID__c" :"66", "Date_Time__c": "2015-09-13T22:30:00.000Z", ...
1
vote
1answer
22 views

Event parent relationship fields are null in trigger

I am populating a junction object on from Events and want to capture info from the Event but getting the Account from Account field pulls null. Same who the name via the Who. But if I query the Event ...
3
votes
2answers
58 views

Unable to create Master Detail Relatioship

I have some custom object - TestObj1, TestObj2, TestObj3.... TestObj1 - Only have 2 Master-Detail fields(With TestObj3 and TestObj4 Objects) TestObj2 - I have Master-Detail with TestObj5 now Why ...
4
votes
2answers
87 views

Junction object in Salesforce

What kind of relation should a junction object have with it's parent objects? What I know from Salesforce documentation: The junction object should have master-detail relationships with the parent ...
1
vote
1answer
47 views

Building custom VF approval page Query Issues

Some questions on displaying on what I can show in querying the Process. 1 - I am running into limitations on pulling in more fields in my query. public List<ProcessInstanceStep> getSteps() { ...
2
votes
0answers
35 views

Create Asset hierarchy in single REST API call - Parent and child assets

I would like to create Asset hierachy with a single REST API call, providing root Asset and his child Assets (Documentation). I can't do this because it seems that Asset.ParentId field doesn't have ...
3
votes
1answer
21 views

Are Sharing Settings of Relationship fields retrievable by Schema or Metadata/Tooling API?

Is there a way to find out in Apex code if on of the two radio options is set in an Org?
2
votes
1answer
24 views

Querying related objects

I have a relationship between objects as below: User->Contacts->Account->Parent I am trying to get the parent id using the following SOQL query: [Select user.contacts.account.parentid from ...
-1
votes
3answers
35 views

“update object.relatedObject__r” caused “Attempt to de-reference a null object” error in Unit Test

The code is working. Just to make it in Production, I need to do proper unit test to make sure the code coverage is above 75%. In the Controller Extension, I made a simple Page Reference to save the ...
0
votes
0answers
22 views

Junction object sharing rules in many to many relationship

While creating many to many relationship object A is read only & B is read/write. Object c is junction object. Can anyone explain which sharing rule will be eligible for junction object i.e. ...
3
votes
1answer
134 views

Circular Lookup Reference

We have two objects "Project" and "Project Members". Project is child of some other object with master-child relationship. So, we can't have "Master-Detail" relationship between "Project" and "Project ...
0
votes
0answers
18 views

Custom App Security Model

I have an app that has a number of custom objects that are linked with a master detail relationship model. The app needs to be generic as I won't know the security setup up front. The app is also ...
1
vote
2answers
68 views

Unable to create Master-Detail relationship field

I am configuring a many-to-many relationship between custom object and Contact. For this purpose I created a junction object. Next, I have to create 2 Master-Detail relations. One for custom object, ...
2
votes
2answers
218 views

Relationship between Opportunity, OpportunityLineItems(Opportunity Product), PricebookEntry, Product2 & Pricebookentry in Salesforce?

Correct me if am wrong in these relation Ship between Opportunity, OpportunityLineItems(Opportunity Product), PricebookEntry, Product2 & Pricebookentry in Salesforce. OpportunitylineItem is ...
0
votes
0answers
16 views

What are the criteria for being able to set object related data in memory?

First, all the background information I'm not entirely sure if Related Data is the proper thing to call this, but it's the best/most concise label I can think up. As an example, take the following ...
1
vote
1answer
48 views

Relationship Query issue

i need your help to understand my problem with a relationship query. I want to get all users with the role "ceo" so i tested the following query in the workbench: SELECT Id,Email,Name FROM User ...
0
votes
1answer
36 views

Lookup Filter with related fields that are more than one relationship away from the lookup object

I want to add a lookup filter for the lookup between Package Version and Release. So I just can choose Releases which are linked to the same Program as my related Package. This is not possible ...
1
vote
1answer
123 views

Filter for lookup on object in many-to-many relationship

I have two custom objects - A and B, which have many-to-many relationship, presented by a third custom object - A_B_Asoc. A ------> A_B_Asoc <------ B In Opportunity, I have a lookup to A, ...
2
votes
2answers
35 views

Relationships in SOQL

Background: I'm new to Saleforce SOQL Just installed FORCE.com Explorer to create and test quires which I will using on a third-party Dashbboard that supports SOQL. What I'm doing: I'm trying ...
0
votes
1answer
33 views

VF Controller Test not picking up Field on Parent Object

I have a VF Page for a Custom Object that asks a User for a PIN and checks it versus a field on the Contact Object which is it's direct Parent. This Controller Extension is used for 2 other VF Pages, ...
4
votes
1answer
39 views

Look up to Master-detail through MetaData API: “cannot add master-detail relationship due to existing data rows”

Trying to change the existing relation between A(Parent) and B(Child) from Look up to Master- Detail. Deploying "B__c.A__c" using ANT. Ran a query on B and made sure all B__c.A__c is populated (As ...
2
votes
0answers
41 views

How to subquery “Default Opportunity Team” when querying for User?

Cannot figure out the relationship name for Default Opportunity Team on User. List<User> users = [select id, name, // default opportunity team (select id, TeamMemberRole, ...
-1
votes
1answer
18 views

how to Achieve this one object have two master details relationships records

how to Achieve this one object have two master details relationships records i want more ...how i achieve this...using rollupsummary Please xplain briefly
0
votes
1answer
58 views

Check if a contact or Lead already exist in a lookup relationship

Supposed I have a guestList__c Object. Then I have another object called as guest__c which is related to guestList__c,Contact or Lead objects. From the name of the object itself, guest__c store the ...
0
votes
2answers
39 views

Access object fields in a query

I got 3 objects, BUnit__c, Row__c and Portfolio__c, with the following design Portfolio__c(Many)-----------(1) BUnit__c (1)-----------(Many)Row__c Portfolio__c object has a lookup to the BUnit__c, ...
0
votes
1answer
30 views

how many look up relationship in salesforce

how many lookup relationship can I create in salesforce? can you send me a link about this topic?
0
votes
1answer
29 views

fetching records on vf with two object with lookup relation in them in salesforce

i have two object Timeslot__c and Commercial_Slot__c i have a field name timeslot which is lookup in commercial_slot__c on timeslot__c i am feching timeslot records on vf page and also want the ...
1
vote
1answer
36 views

How to enter multiple contacts in one custom object?

I created a custom Object "Visit Reports" and would like to be able to pick all participants from the Standard object Contacts. I have entered several "Participant 1, 2, 3,..." lookup fields to ...
2
votes
0answers
21 views

Search in related objects fields

Is there a way to make a single SOSL query to search in fields of related objects? For example: "find all tasks related to accounts are named X*".
2
votes
1answer
53 views

Any reason not to use Lookups instead of Master-Details for Junction object?

To build n-m relationships one needs a Linker/Junction object with two references. The Salesforce documentation recommends two Master-Detail relationships. Is there any reason why not to use two ...
1
vote
2answers
70 views

Lookup Relationship: One to Many where Child can belong to Multiple Parent

I wish to have a Gym object that contain zero or more members as a related list. So Gym is the master and Member is the detail side - but the Member records does NOT have to be linked to any ...
1
vote
1answer
18 views

Accounts & Contacts Relationship - Where Defined?

In the schema builder diagram, there is a 1:M lookup relationship between Accounts and Contacts. However, I cannot find where this lookup relationship is defined. Is it under the ...
0
votes
1answer
47 views

How to get all participants from Event

How get all participant from each Event and check if they are leads or not? Is it possible with one query?
1
vote
2answers
55 views

Retrieve relationship values in SOQL query

Expense__c expenses = [select Owner.Name, Contact__r.Name, from Expense__c]; for (Expense__c i : expenses) { String expOwner = String.valueOf(i.get('Owner.Name')); String contact = ...
0
votes
2answers
34 views

error of __r job and joballocation

Error: Compile Error: Didn't understand relationship 'JobAllocation__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom ...
2
votes
1answer
58 views

How to display a list of related cases inside a pageBlockTable?

I have a pageBlockTable which has a list of custom objects (Project__c). I want to display a related list in the column of the pageBlockTable with the associated cases for each custom object. I've ...
1
vote
0answers
33 views

APEX , sobject based on multiple IDs

There are 4 custom objects (starting with CO_) in the below for loop which are all inter connected and this code is working as expected. prodId is the Salesforce ID of CO_Product__c which is passed as ...
1
vote
2answers
28 views

list of records without childs

am very new to coding stuff and I am creating a trigger to count the total number of child accounts and the total number of dependent child account with some code that I found in this page to emulate ...
0
votes
1answer
38 views

Working off the Quote in Visualforce, how can I access Contacts? Getting an unsupported complex expression error

The quote is associated with an account, and the account has contacts. I can access the account data just fine, but when I try to display any contact data then it fails with the following error: ...
4
votes
1answer
74 views

Query and Follow Owner Relationship on Tasks

I actually can't believe I've not come across this before now, but is there a way of following on the owner relationship on a Task to get some other field on the User object? For an example, say on ...
2
votes
2answers
51 views

User with no access to child object can create records?

I have two objects Parent__c and Child__c with parent-child relationship. OWD settings for Parent__c is Public Read/Write and for Child__c it is Private. The User1 has Read/Write/Delete/Edit access ...
1
vote
2answers
59 views

Query all accounts that is related to another account effeciently

I've created a custom lookup field for account object and I call it as primary_account__c. Now, I want to query all primary_account__c with its related account what is the best way to do it ? I've ...