当前位置:网站首页>Salesforce uses hyperlink formula field to implement custom jump
Salesforce uses hyperlink formula field to implement custom jump
2022-06-24 01:24:00 【repick】
1.HYPERLINK FORMULA field
a. A number of projects are completed
Digital content :
HYPERLINK("https://www.baidu.com/", "baidu1")
b.DB Search in , See what the stored data looks like
According to the search results 【target="_blank"】, Will jump to a new Tab.
Search results :
<a href="https://www.baidu.com/" target="_blank">baidu1</a>
c. detailed Page in , Drag the custom item in , To test
The result is as expected , Will open a new Tab.
※ Jump from the screen , Parameters can be specified
HYPERLINK("https://www.baidu.com/", "baidu1", '_self')
HYPERLINK("https://www.baidu.com/", "baidu3", '_top')
2. Practical application example
The above method helps us realize page Jump , In actual project applications , The jump logic is relatively complex , In this case , We can consider writing logic processing in the background ApexClass in .
a. First, to test , You need to create two custom numeric items for jump , Then prepare two parameters , Used for background judgment .
stay Opportunity detailed Page Configure two items on , Including items 1 Used to jump to 【https://bing.com/】 page ,
project 2 Used to jump to 【https://cn.bing.com/translator?mkt=zh-CN】.
project 1 Digital content :
HYPERLINK("/apex/MyLinkForVF?recordId="+Id+"&linkId=linkId001", "GoTo Bing")
project 2 Digital content :
HYPERLINK("/apex/MyLinkForVF?recordId="+Id+"&linkId=linkId002", "GoTo Bing translator")
b. establish VFPage With the corresponding ApexClass, Used for logical judgment
MyLinkForVF.page
<apex:page controller="MyLinkForVFController" action="{!navigationToLink}">
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<!-- End Default Content REMOVE THIS -->
</apex:page>MyLinkForVFController
public with sharing class MyLinkForVFController {
public Id recordId {get; set; }
public String linkId {get; set; }
public String resultURL { get; set; }
public Boolean isMobile { get; set; }
public MyLinkForVFController() {
String recordId = ApexPages.currentPage().getParameters().get('recordId');
String linkId = ApexPages.currentPage().getParameters().get('linkId');
String header= ApexPages.currentPage().getHeaders().get('User-Agent');
String apiName;
String recordIdPrefix = recordId.substring(0, 3);
Map<String,Schema.SObjectType> globalDescribeMap = Schema.getGlobalDescribe();
for(String objectN : globalDescribeMap.keySet()) {
Schema.DescribeSObjectResult result = globalDescribeMap.get(objectN).getDescribe();
String prefix = result.getKeyPrefix();
if(String.isNotBlank(prefix) && prefix.equalsIgnorecase(recordIdPrefix)) {
apiName = result.getName();
}
}
if (header.toLowerCase().contains('iphone')) {
isMobile = true;
} else {
isMobile = false;
if ('Opportunity'.equalsIgnoreCase(apiName)) {
if ('linkId001'.equalsIgnoreCase(linkId)) {
resultURL = 'https://bing.com/';
} else if ('linkId002'.equalsIgnoreCase(linkId)) {
resultURL = 'https://cn.bing.com/translator?mkt=zh-CN';
}
} else if ('Account'.equalsIgnoreCase(apiName)) {
resultURL = 'https://www.baidu.com/';
}
}
}
public PageReference navigationToLink() {
if(isMobile) {
Pagereference pageRef;
//pageRef = Page.xxxx;
pageRef.getParameters().put('errorMessage', 'Mobile Access Error');
pageRef.setRedirect(true);
return pageRef;
} else {
PageReference pageRef = new PageReference(resultURL);
pageRef.setRedirect(true);
return pageRef;
}
}
}Effect display :
Click on 【GoTo Bing】Link
Click on 【GoTo Bing translator】Link
边栏推荐
- Installation and use of winscp and putty
- 分别用SVM、贝叶斯分类、二叉树、CNN实现手写数字识别
- 什么是养老理财?养老理财产品有哪些?
- [new secsha!] Have you got the 22 year new seckill activity of Tencent cloud?
- Intelligent + fault-tolerant server is the best partner in the edge computing scenario
- [technology planting grass] talk about the system design and architecture of large-scale shopping platform
- Dart series part: asynchronous programming in dart
- Why traifik ingress?
- 一次 MySQL 误操作导致的事故,「高可用」都顶不住了!
- Talk to Wu Jiesheng, head of Alibaba cloud storage: my 20 years of data storage (unlimited growth)
猜你喜欢
![[applet] when compiling the preview applet, a -80063 error prompt appears](/img/4e/722d76aa0ca3576164fbed4e2c4db2.png)
[applet] when compiling the preview applet, a -80063 error prompt appears

Real time computing framework: Flink cluster construction and operation mechanism
![[machine learning] linear regression prediction](/img/74/9b5067bb9057049c998898ff2457f1.png)
[machine learning] linear regression prediction

Shardingsphere-proxy-5.0.0 implementation of capacity range partition (V)

Perhaps the greatest romance of programmers is to commemorate their dead mother with a software

LMS Virtual. Derivation method of lab acoustic simulation results

LSF打开Job idle information以看job的cpu time/elapse time使用情况

Application configuration management, basic principle analysis

Installation and use of winscp and putty

跨域和JSONP
随机推荐
Basic templates for various configurations of the SSM framework
What is the website domain name trademark registration process? What is the use of a website domain name trademark?
How to learn website construction does website construction need code
分别用SVM、贝叶斯分类、二叉树、CNN实现手写数字识别
Leetcode lecture on algorithm interview for large factories 2 Time space complexity
CVPR2022 | 可精简域适应
Open source model library of flying propeller industry: accelerating the development and application of enterprise AI tasks
Grab startup logcat
[planting grass by technology] 13 years' record of the prince of wool collecting on the cloud moving to Tencent cloud
Sockfwd a data forwarding gadget
[flutter] comment utiliser les paquets et plug - ins flutter
Shengdun technology joined dragon lizard community to build a new open source ecosystem
Is the domain name available for trademark registration? How long is the trademark registration cycle?
Pad User Guide
Echo framework: automatically add requestid
SAP executes PGI on the delivery order of STO and reports an error -fld selectn for Mvmt type 643 acct 400020 differences
Interviewer: why does the new generation memory need two survivor zones?
Remove the cloud disk service display "continued" logo
Isn't this another go bug?
Application configuration management, basic principle analysis