• Admin User 9994
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
We have deprecated Apex code that needs to be removed from Production. When attempting to do so either through Workbench, or through Visual Studio Code, the usual code coverage error prohibits me from doing so because there is not enough coverage. This is a catch 22, because the Classes/Triggers I need to remove are the cause of the lack of code coverage. The functionality they cover is being removed, so there's nothing to write a test Class for.
 
We have a javascript button in classic. Using the Lightning Experience Configuration Converter, a lightning component and controller were automatically generated. However, the new action button generated by Salesforce and placed on the page layout does not seem to be working.

The button is clicked and the component modal pops up for a second, then quickly goes away and goes to an invalid record page.

Any insight at all would be helpful as standard SFDC support will not look at the code.

Original Code:
if('{!JSENCODE( Program__c.Accreditation__c )}' == '') { 
alert('Accreditation is blank. This must be set for Program Tasks.'); 
} 
else { 
window.location.href='/apex/CreateProgramTasks?id={!Program__c.Id}'; 
}
Generated Lightning Component:
<aura:component extends="c:LCC_GenericLightningComponent" >
    <aura:handler event="c:LCC_GenericApplicationEvent" action="{!c.execute}"/>
    <aura:set attribute="partially" value="false"></aura:set>
    <aura:attribute name="showAlert" type="Boolean" default="false"/>
    <aura:attribute name="alertText" type="String"/>
    <aura:set attribute="isAdditionalObject" value="false"></aura:set>

    <div>
        <div class="slds-scrollable slds-p-around_medium slds-text-heading_small" id="modal-content-id-1">
            <aura:if isTrue="{!v.showAlert}">
                <p class="slds-hyphenate">{!v.alertText}</p>
                <aura:set attribute="else">
                    <div style="height: 6.75rem;">
                        <div role="status" class="slds-spinner slds-spinner_large slds-spinner_brand">
                            <span class="slds-assistive-text">Loading</span>
                            <div class="slds-spinner__dot-a"></div>
                            <div class="slds-spinner__dot-b"></div>
                        </div>
                    </div>
                </aura:set>
            </aura:if>
            <br/>
        </div>
        <footer class="slds-modal__footer">
            <lightning:button class="slds-button_brand" onclick="{!c.accept}" label="Accept"/>
        </footer>
    </div>
</aura:component>
Generated Controller:
({
	execute : function(component, event, helper) {
		// TODO: Review the migrated code
		if (''+component.get('v.sObjectInfo.JSENCODE( Program__c.Accreditation__c )')+'' == '') 
  {
  helper.showTextAlert(component, 'Accreditation is blank. This must be set for Program Tasks.');
}
else 
  {
helper.gotoURL(component, 'v.sObjectInfo.Id');
}


	},

	accept : function(component, event, helper) {
		$A.get("e.force:closeQuickAction").fire();
	}
})



 
We have deprecated Apex code that needs to be removed from Production. When attempting to do so either through Workbench, or through Visual Studio Code, the usual code coverage error prohibits me from doing so because there is not enough coverage. This is a catch 22, because the Classes/Triggers I need to remove are the cause of the lack of code coverage. The functionality they cover is being removed, so there's nothing to write a test Class for.
 
We have a javascript button in classic. Using the Lightning Experience Configuration Converter, a lightning component and controller were automatically generated. However, the new action button generated by Salesforce and placed on the page layout does not seem to be working.

The button is clicked and the component modal pops up for a second, then quickly goes away and goes to an invalid record page.

Any insight at all would be helpful as standard SFDC support will not look at the code.

Original Code:
if('{!JSENCODE( Program__c.Accreditation__c )}' == '') { 
alert('Accreditation is blank. This must be set for Program Tasks.'); 
} 
else { 
window.location.href='/apex/CreateProgramTasks?id={!Program__c.Id}'; 
}
Generated Lightning Component:
<aura:component extends="c:LCC_GenericLightningComponent" >
    <aura:handler event="c:LCC_GenericApplicationEvent" action="{!c.execute}"/>
    <aura:set attribute="partially" value="false"></aura:set>
    <aura:attribute name="showAlert" type="Boolean" default="false"/>
    <aura:attribute name="alertText" type="String"/>
    <aura:set attribute="isAdditionalObject" value="false"></aura:set>

    <div>
        <div class="slds-scrollable slds-p-around_medium slds-text-heading_small" id="modal-content-id-1">
            <aura:if isTrue="{!v.showAlert}">
                <p class="slds-hyphenate">{!v.alertText}</p>
                <aura:set attribute="else">
                    <div style="height: 6.75rem;">
                        <div role="status" class="slds-spinner slds-spinner_large slds-spinner_brand">
                            <span class="slds-assistive-text">Loading</span>
                            <div class="slds-spinner__dot-a"></div>
                            <div class="slds-spinner__dot-b"></div>
                        </div>
                    </div>
                </aura:set>
            </aura:if>
            <br/>
        </div>
        <footer class="slds-modal__footer">
            <lightning:button class="slds-button_brand" onclick="{!c.accept}" label="Accept"/>
        </footer>
    </div>
</aura:component>
Generated Controller:
({
	execute : function(component, event, helper) {
		// TODO: Review the migrated code
		if (''+component.get('v.sObjectInfo.JSENCODE( Program__c.Accreditation__c )')+'' == '') 
  {
  helper.showTextAlert(component, 'Accreditation is blank. This must be set for Program Tasks.');
}
else 
  {
helper.gotoURL(component, 'v.sObjectInfo.Id');
}


	},

	accept : function(component, event, helper) {
		$A.get("e.force:closeQuickAction").fire();
	}
})