开发者

relate an object in salesforce with multiple objects

开发者 https://www.devze.com 2023-03-29 20:29 出处:网络
1) I have created a custom object \"Hello\". Added two lookup fields to it, one is associated to Accounts and another to Leads.

1) I have created a custom object "Hello". Added two lookup fields to it, one is associated to Accounts and another to Leads.

2) now my custom object appears as a related list in both Account and lead

3) if i goto an account say "**Test_开发者_运维知识库account**"  >> i click on the new button 
   on the "Hello" related list.here i have redirected to a custom 
   visualforce page "**Welcome**".

Now I want that on my "Welcome Page" I want to display 2 fields.

If user reached this "Welcome Page" via hello related list in accounts then label on this page is set to Accounts

but

If user reached this "Welcome Page" via hello related list in leads then label on this page is set to Leads.

I dont know how to do this. I can get the retURL in the currentpage URL but it gives me only the id. Now I am not sure this id belongs to Accounts or Leads.

Accounts nad leads are just examples,there could be many more ojects.


By looking at the first three characters of the id, you can tell the type of object. For example, all Accounts start with '001' and all Leads start with '00Q'. You can get all the key prefixes from the DescribeSObjectResult in either Apex or the Web Services API. The API also returns this in the DescribeGlobalResult, which is handy if you want to load all the key prefixes in one call. The REST API also has the key prefix, but you'd have to traverse all the objects to get to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号