• Robert Robinson 48
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
We are using an Apex class to allow users to select and insert a value (Extraction Vehicle) on a CPQ Quote Line (Apex Class named qtc_ExtractionCTRL). This Apex Class worked fine in the UAT environment until UAT was refreshed from Production. The Apex Class code is shown below:

public class qtc_ExtractionCTRL {
public String qlId {get;set;}
public ExtractionVehicle__c theExtraction {get;set;}
public List exList {get;set;}

public qtc_ExtractionCTRL(){
this.qlId = Apexpages.currentPage().getParameters().get('Id');
this.theExtraction = new ExtractionVehicle__c();
this.exList = [SELECT Id, ExtractionVehicleName__c, QuoteLine__c FROM ExtractionVehicle__c WHERE QuoteLine__c =: qlId];

}

public void Submit()
{
theExtraction.QuoteLine__c = qlId;
Database.insert(theExtraction);
theExtraction = new ExtractionVehicle__c();
exList = [SELECT Id, ExtractionVehicleName__c, QuoteLine__c FROM ExtractionVehicle__c WHERE QuoteLine__c =: qlId];
}

}


The error that we see when the Apex Class fires is:

"Invalid id:
Error is in expression '{!Submit}' in component in page qtc_extraction: Class.qtc_ExtractionCTRL.Submit: line 15, column 1

An unexpected error has occurred. Your development organization has been notified."


The line in question is : theExtraction.QuoteLine__c = qlId;


From what I can figure, the Class is referencing Production somehow. I am not sure how.
We have a set of JavaScript buttons which are designed to generate new opportunities when a user clicks a button from a related list on an account. These buttons were working as planned yesterday. Overnight, we refreshed our full UAT sandbox from production. This morning, when I try to generate a new opportunity in the sandbox, Salesforce opens up a new page and tries to log in to production. The process then errors out, as the system is trying to create an opportunity in the wrong environment. When you take the ID generated in production, then apply it back to the sandbox, a new opportunity is then created. I have reviewed the JavaScript button, and I see no references to the production org.

Here is one of the JavaScript buttons:
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/31.0/apex.js")} var opportunity = new sforce.SObject('Opportunity'); opportunity.Name = 'Do Not Delete'; opportunity.AccountId = '{!Account.Id}'; opportunity.RecordTypeId = '{!$Setup.Opportunity_Record_Type_Ids__c.Standard_Services__c}'; opportunity.StageName = 'Qualification'; var closeDate = new Date('{!TODAY()}'); closeDate.setMonth(closeDate.getMonth()+6); opportunity.CloseDate = closeDate; var result = sforce.connection.create([opportunity]); if(result[0].success == 'true'){ var serverPrefix = '{!$Setup.Server_Prefix__c.Server_Prefix__c}'; var oppId = result[0].id; parent.window.location.href = 'https://' + serverPrefix + '.salesforce.com/' + oppId; } else{ alert('Record creation failed - please notify system administrator'); }

The Standard Services Opportunity Record ID is in Custom Settings. The Record IDs point to Record types within UAT
I am inheriting an org with quite a bit of automation left by a consultant. I am trying to determine efficiently what type of automation (Flow, Process Builder, etc) is being used. Is there any way to trap a process when it is run and see the root automation behind it? Thanks.
We have a set of JavaScript buttons which are designed to generate new opportunities when a user clicks a button from a related list on an account. These buttons were working as planned yesterday. Overnight, we refreshed our full UAT sandbox from production. This morning, when I try to generate a new opportunity in the sandbox, Salesforce opens up a new page and tries to log in to production. The process then errors out, as the system is trying to create an opportunity in the wrong environment. When you take the ID generated in production, then apply it back to the sandbox, a new opportunity is then created. I have reviewed the JavaScript button, and I see no references to the production org.

Here is one of the JavaScript buttons:
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/31.0/apex.js")} var opportunity = new sforce.SObject('Opportunity'); opportunity.Name = 'Do Not Delete'; opportunity.AccountId = '{!Account.Id}'; opportunity.RecordTypeId = '{!$Setup.Opportunity_Record_Type_Ids__c.Standard_Services__c}'; opportunity.StageName = 'Qualification'; var closeDate = new Date('{!TODAY()}'); closeDate.setMonth(closeDate.getMonth()+6); opportunity.CloseDate = closeDate; var result = sforce.connection.create([opportunity]); if(result[0].success == 'true'){ var serverPrefix = '{!$Setup.Server_Prefix__c.Server_Prefix__c}'; var oppId = result[0].id; parent.window.location.href = 'https://' + serverPrefix + '.salesforce.com/' + oppId; } else{ alert('Record creation failed - please notify system administrator'); }

The Standard Services Opportunity Record ID is in Custom Settings. The Record IDs point to Record types within UAT
I am inheriting an org with quite a bit of automation left by a consultant. I am trying to determine efficiently what type of automation (Flow, Process Builder, etc) is being used. Is there any way to trap a process when it is run and see the root automation behind it? Thanks.
Java Script issue - referencing record type
I am following up after a consultant that used JavaScript to direct users to 1 of 2 record types from an Account Related List. I have added a 3rd record type, and am trying to create a button that references the JavaScript. Here is the code that I am working with:
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/31.0/apex.js")} 

var opportunity = new sforce.SObject('Opportunity'); 

opportunity.Name = 'Do Not Delete'; 
opportunity.AccountId = '{!Account.Id}'; 
opportunity.RecordTypeId = '{!$Setup.Opportunity_Record_Type_Ids__c.Record_Type_3__c}';
opportunity.StageName = 'Quote in Progress'; 



var closeDate = new Date('{!TODAY()}'); 
closeDate.setMonth(closeDate.getMonth()+6); 
opportunity.CloseDate = closeDate; 

var result = sforce.connection.create([opportunity]); 

if(result[0].success == 'true'){ 
var serverPrefix = '{!$Setup.Server_Prefix__c.Server_Prefix__c}'; 
var oppId = result[0].id; 
parent.window.location.href = 'https://' + serverPrefix + '.salesforce.com/' + oppId; 

else{ 
alert('Record creation failed - please notify system administrator'); 
}

The bold, italicized area is where the error is. The error message is:
<span class="errorStyle">Error: Field Record_Type_3__c does not exist. Check spelling.</span>

Record Type 3 does exist, and the spelling is correct. Is there someplace else that I need to define the "Record_Type_3" field? Thanks.