+ Start a Discussion

Getting sObject field "ID" ?

I have a user operation that creates a series of child records against a master record.


After a user operation completes, I want to send them back to the page for the master record and down the page to the related list for the child records. ... It's just a nicer user experience...


I notice that when I click the related list title in the header of the page, the URL is:



where 'a0I800000047wms' is the ID for the master object, and '00N80000003aRvw' is the field id for the foreign key of the field on the child object pointing back to the master object. So if I just go to https://na6.salesforce.com/00N80000003aRvw, I'm taken to the field properties for that field.


If I could dynamically pull that field ID given an sObject or sObjectField, I could do this -- but I can't seem to figure out a way to find it. I've tried CustomObject__c.SObjectType.getDescribe().getChildRelationships() and running getField().getDescribe() on each of the child relationship records, but nothing...


Any ideas?

Did you ever get a solution to this?  I am trying to do a similar thing, put the Id of a field into a URL and can't seem to get it through any Apex describe calls.
No, I never found a solution. I've checked with others too and they say I'm out of luck.