Use of JavaScript in WebLinks
Why is this an issue?
JavaScript WebLinks are no longer supported in Lightning Experience. They:
Do not work in Lightning Experience
Cannot be used in the Salesforce mobile app
Are considered legacy functionality
Examples
Example of incorrect WebLink (where linkType is javascript):
<WebLink>
<fullName>Account.Update_Status</fullName>
<linkType>javascript</linkType>
<url>alert('Updating status...');</url>
</WebLink>
Example of incorrect WebLink (where openType is onClickJavaScript):
<WebLink>
<fullName>Account.Update_Status</fullName>
<linkType>url</linkType>
<openType>onClickJavaScript</openType>
<url>/apex/MyPage?id={!Account.Id}</url>
</WebLink>
Example of correct approach (Lightning Quick Action). Note that the offending WebLink is replaced by a different metadata type β there is no Lightning-compatible variant of a JavaScript WebLink:
<QuickAction>
<fullName>Account.Update_Status</fullName>
<type>LightningComponent</type>
<lightningComponent>c:UpdateStatusAction</lightningComponent>
</QuickAction>
How can I fix violations?
Replace JavaScript Weblinks with Lightning-compatible alternatives:
Quick Actions: For simple record operations, use quick actions.
Lightning Web Components: For complex functionality, build LWC components and add them to page layouts.
Flow: For guided processes, use Screen Flows launched from buttons.
Custom Lightning Actions: Create Lightning components that can be invoked from buttons.
When should I disable this rule?
You may dismiss specific violations for orgs that exclusively use Salesforce Classic with no plans to migrate to Lightning Experience.
Resources
