I am trying to create a custom button using Javascript to create a custom object record (Project__c) from another custom object record (Quote__c). The problem is I need to pull the Opportunity ID and Record Type from the Quote__c object into the Project__c object, but I'm not sure of the syntax to use in Javascript to accomplish this. Anytime I enter the fields below, I get an error telling me the field is invalid.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} var crfId=sforce.connection.query("Select id from Project__c Where Quote__c.Id='{!Quote__c.Id}'"); var oppId=sforce.connection.query("Select Opportunity2__c.Id from Quote__c"); var quoteId=sforce.connection.query("Select Id from Quote__c"); var oppRTId=sforce.connection.query("Select RecordTypeId. from Opportunity"); if(crfId.size == 0) { window.open("/apex/VF_Quote?id=quoteId&OppRecordType=oppRTId"); } else{ alert('The Opportunity already has a Contract Request associated to it.'); }