I presume you mean GUID and not PID?
If so here is a sample of the code we use on the onLoad event of the Contact entity to get the record GUID.
try
{
crmForm.all.new_recordguid.DataValue = window.location.href.split("?")[1].split("=")[1];
crmForm.all.new_recordguid.DataValue = crmForm.all.new_recordguid.DataValue.replace("#", "");
}
catch(e){}
Where new_recorduid is the name of the attribute where we store the guild value we grabbed.
Jerry
http://www.crminnovation.com