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
JohnWJohnW 

Custom Object Linkage

Can anyone help me, i need to update a custom object thats attached to a contact object but have can see no way to link them. i've tried using the id form the contact form to link to the OwnerId of the custom object but no joy.
 
Any ideas would be most appriciated
 
Cheers
Gareth DaviesGareth Davies

Download the Developers' sidekick from the AppExchange.

If you click on the contact object in the object list of the Schema Explorer you will see that it will tell you what this object is referenced by and the field that references it.

(This will list all objects that have a child relationship to Contact), if it's a parent object then reverse the procedure..

My guess is that it will be a field called ContactId__c

Cheers

Gareth.

Mike LeachMike Leach
If there is a Lookup relationship between Contact and the custom object, then the custom object id should be accessible through the API for updating.

The ID will look something like "Custom_Object__c".
jeff.lopezstuitjeff.lopezstuit
In my experience, the foreign key within the custom object that links to contact will be called "contact__c", unless you explicitly changed the field name when you set the relationship up.

Note that to do an update of a record in the custom object, you'll need to use the id field in that object.  I don't think you can do an update based on a query against contact__c (or any other field but id, for that matter...)

Jeff
RRESRRES
When creating links that create new custom object records (I assume this is what your trying to do) there are two parts you need to do.

1. Create the link
2. Name the link

For example if you'd like to create a new project (custom object) from an opportunity and link the project to the account listed in the opportunity,  your code would look like this:

 https://na1.salesforce.com/a06/e—retURL=%2Fa06%2Fo&CF00N30000001JBPJ_lkid={!Opportunity_Account_ID}& CF00N30000001JBPJ={!Opportunity_Account}

00N30000001JBPJ is the field of the relationship on the project that links to an account.

Notice the CF00N30000001JBPJ_lkid={!Opportunity_Account_ID}.  This is the link between the account and the new project that is being created. Then look at CF00N30000001JBPJ={!Opportunity_Account}. This is where the Account name is added. The only difference between the name of the field is the _lkid which is used to create the link. The other thing I noticed is that the actual field name in the Project object is 00N30000001JBPJ but for some reason you need the letters CF before the field to get the link to work.

Hope this helps.

Rich

Message Edited by RRES on 09-17-2006 01:12 AM

JohnWJohnW
thanks guys that sorted that issue