I have a visualforce page that will be accessed via a List Button. This VF page relates to the case object and the list button will appear on several object UIs (opportunity, account etc) related lists.
Using the "Execute Javascript" option I wish to open the visualforce page using a location.replace function but I wish to add the record Id and the sObjectType/API Name in URL parameters from the parent/source that the related list was clicked on.
I know how to get the record Id in the parameter but is there a global variable or a method i can use to include the sObjectName/API Name as a parameter?
For example, the location.replace url will look like:
/apex/vfPage?parentId={!Id}&sObjectName={SOBJECTVARIABLE}
From my understanding if I use a VF page redirect using a standard controller I will receive the parent Id but not the sObject name.
Does anybody know how I can achieve this?