You need to sign in to do that
Don't have an account?
Admin User 9994
Javascript to Lightning Component Conversion
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:
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(); } })
I have just run into the exact same issue. Were you able to resolve this?
Thanks.
Bryan Hunt
Not directly. I ended up creating a Flow to accomplish the function instead.