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

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 12
    Replies
I have inherited an org from a consultant. There is not a lot of documentation on the automation that they created, so I am basically building the catalog from scratch. My documentation will list out the usual suspects (Apex, PB, Flow, Validation and Workflow Rules, etc.) with the purpose and a focus on the interactions between each. Wondering about similar efforts that others have performed. Any tips or lessons learned that anyone wishes to share? Thanks.
I have the following Apex trigger in Sandbox:
public class New_Device_Opp_Controller {
@AuraEnabled
    public static string createDeviceOpportunity(Id AccountrecId)
    {
        String returnValue = '';
        List<Opportunity> oppList = new List<Opportunity>();
        Opportunity oppObject = new Opportunity();
  
        oppObject.Name = 'Do Not Delete'; 
        oppObject.AccountId = AccountrecId; 
        oppObject.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Device Consulting').getRecordTypeId(); 
        oppObject.StageName = 'Qualification'; 
        Date closeDate = system.today(); 
    oppObject.CloseDate = closeDate;
        oppList.add(oppObject);
        if(!oppList.isEmpty())
    {
    Database.SaveResult[] a = Database.insert(oppList, false);
    if(a[0].isSuccess())
    {
      returnValue = oppList[0].id;
    }
    else
    {
      returnValue =  'failure';
    }
    }
        return returnValue;    
    }
}

My Test class provides 94% coverage in the sandbox

When I attempt to promote, I select the "Run Specified Tests" becuase our consultants left us with garbage classes to clean up (another story for another day). When I run the specific test, I get this error: 

Code Coverage Failure
Your code coverage is 0%. You need at least 75% coverage to complete this deployment.
New_Device_Opp_Controller


How can I clear this error? Thanks.
I am creating a Flow where I update existing records. I have over 25 fields that I am updating; 100% of Text and simple picklist input from the Flow are updating fine in the record; however, when I populate a multi-select picklist, the values from that picklist do not update in the record. 
Is there an additional step that I must perform in order for values coming from multi-select picklists to update records properly? Thanks.
I am working with Lightning Flow Builder. I have a 5 answer picklist on which I am trying to base my decsion tree (for example, if the user selects the first option, they will be taken to the screen related to the first option, if they select the second option, the second screen and so forth).

My problem is that I cannot pick the picklist options when creating the outcome. I select All Conditions are met from the When to Execute Outcome, but when I select the  Resource, I cannot select the first option of 5 (in cases when the user selected the first option). Do I have to assign a resource to the option which the user selected, or is there something simpler that I am missing? Thanks.
I am having a major brain block. I have the following Apex Trigger designed to keep a Probability % at a previously (manually) set level. This is that code:
trigger keepProbability on Opportunity (before update) {
    for(Integer i = 0; i < Trigger.new.size(); i++) {
        if(Trigger.old[i].stagename != Trigger.new[i].stagename) {
            if(Trigger.old[i].probability != Trigger.new[i].probability) {
               Trigger.new[i].probability = Trigger.old[i].probability;
            }
        }
    }

}

The trigger works great, but I am losing my mind trying to write a Test Class. Any tips on writing the test would be greatly appreciated.
 
I have 5 Controllers which affect opportunities. Each has a test which provides > 90% code coverage in UAT. When I look in production, these tests provide 0% code coverage when the Controllers and related tests are identical between UAT and production. General question is what could cause these tests to fail given the success in UAT and the artifacts promote successfully to production?
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.
I have inherited an org from a consultant. There is not a lot of documentation on the automation that they created, so I am basically building the catalog from scratch. My documentation will list out the usual suspects (Apex, PB, Flow, Validation and Workflow Rules, etc.) with the purpose and a focus on the interactions between each. Wondering about similar efforts that others have performed. Any tips or lessons learned that anyone wishes to share? Thanks.
I have the following Apex trigger in Sandbox:
public class New_Device_Opp_Controller {
@AuraEnabled
    public static string createDeviceOpportunity(Id AccountrecId)
    {
        String returnValue = '';
        List<Opportunity> oppList = new List<Opportunity>();
        Opportunity oppObject = new Opportunity();
  
        oppObject.Name = 'Do Not Delete'; 
        oppObject.AccountId = AccountrecId; 
        oppObject.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Device Consulting').getRecordTypeId(); 
        oppObject.StageName = 'Qualification'; 
        Date closeDate = system.today(); 
    oppObject.CloseDate = closeDate;
        oppList.add(oppObject);
        if(!oppList.isEmpty())
    {
    Database.SaveResult[] a = Database.insert(oppList, false);
    if(a[0].isSuccess())
    {
      returnValue = oppList[0].id;
    }
    else
    {
      returnValue =  'failure';
    }
    }
        return returnValue;    
    }
}

My Test class provides 94% coverage in the sandbox

When I attempt to promote, I select the "Run Specified Tests" becuase our consultants left us with garbage classes to clean up (another story for another day). When I run the specific test, I get this error: 

Code Coverage Failure
Your code coverage is 0%. You need at least 75% coverage to complete this deployment.
New_Device_Opp_Controller


How can I clear this error? Thanks.
I am working with Lightning Flow Builder. I have a 5 answer picklist on which I am trying to base my decsion tree (for example, if the user selects the first option, they will be taken to the screen related to the first option, if they select the second option, the second screen and so forth).

My problem is that I cannot pick the picklist options when creating the outcome. I select All Conditions are met from the When to Execute Outcome, but when I select the  Resource, I cannot select the first option of 5 (in cases when the user selected the first option). Do I have to assign a resource to the option which the user selected, or is there something simpler that I am missing? Thanks.
I am having a major brain block. I have the following Apex Trigger designed to keep a Probability % at a previously (manually) set level. This is that code:
trigger keepProbability on Opportunity (before update) {
    for(Integer i = 0; i < Trigger.new.size(); i++) {
        if(Trigger.old[i].stagename != Trigger.new[i].stagename) {
            if(Trigger.old[i].probability != Trigger.new[i].probability) {
               Trigger.new[i].probability = Trigger.old[i].probability;
            }
        }
    }

}

The trigger works great, but I am losing my mind trying to write a Test Class. Any tips on writing the test would be greatly appreciated.
 
I have 5 Controllers which affect opportunities. Each has a test which provides > 90% code coverage in UAT. When I look in production, these tests provide 0% code coverage when the Controllers and related tests are identical between UAT and production. General question is what could cause these tests to fail given the success in UAT and the artifacts promote successfully to production?
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.