码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • salesforce点击classic按钮调用lightning组件


    创建按钮,选择visualforce 页面,然后创建visualforce页面。

    how to Call a Lightning component from a Classic custom button
    You can definitely call a Lightning Component from a Classic custom button. However, the process is not straightforward as Lightning components are not meant to be directly used in Salesforce Classic, but workarounds could be made to make them usable.

    Here’s a sample process of doing this:

    1. Create your Lightning Component. Please ensure that the component is globally accessible as we are going to use it outside the Lightning Environment. Also, ensure that you have added the component to a Lightning Application.

    2. Create a Visualforce Page to embed the line of code to include the Lightning component in the page. Here’s a sample code of how to do it:

    <apex:page standardController="Account"> 
      <apex:includeLightning />
      <div id="lightning" />
    
      <script>
        $Lightning.use("c:myLightningApp", function() {
          $Lightning.createComponent("c:myLightningComponent",
              { accountId : "{!Account.Id}" }, // pass record id to the component
              "lightning",
              function(cmp) {
                // do some extra stuff after component creation
              });
        });
      script>
    apex:page>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    *Note: c:myLightningApp refers to the Lightning Application that holds your component; and c:myLightningComponent refers to your Lightning Component.

    1. Save the Visualforce page, ensure it is available for use.

    2. Now, create a Classic custom button. In the button setup, choose ‘Display in new window’ as the behavior, and ‘URL’ as the content source, then in the URL field put in:

    /apex/YourVisualforcePagename?Id={!Account.Id}
    
    • 1

    Replace “YourVisualforcePagename” with the actual API name of your visualforce page, and also replace “Account.Id” with the actual object id you are working with if not Account.

    1. After all these, save the button. You can add it to the layout of the object you are working with.

    Please note this procedure works but is a workaround, Salesforce doesn’t support directly using Lightning Components in Salesforce Classic.

    Also, make sure to test all scenarios before deploying it to production.

  • 相关阅读:
    2023年视频号视频下载提取使用教程
    使用python进行页面开发——Django模型层
    cpp编写的tcpserver,python编写的tcpclient,使用自定义的通讯协议
    【目标检测】33、AutoAssign:Differentiable Label Assignment for Dense Object Detection
    Java项目:汽车商城管理系统(java+SpringBoot+VUE+Maven+Mysql)
    【三维重建NeRF(三)】Mip-NeRF论文解读
    【Image captioning】论文精读三–Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
    泰女网红变身外汇投资大师诈骗逾20亿,请警惕身边的“投资大师”
    Spring mvc源码分析系列--前言
    用VS Code搞Qt6:编译附加模块
  • 原文地址:https://blog.csdn.net/lycwhu/article/details/133090057
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号