当前位置:网站首页>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
边栏推荐
- Textplus - reverse engineering of textplus
- Salesforce batch apex batch processing (I)
- Remove the cloud disk service display "continued" logo
- On November 11, 2021, live broadcast e-commerce opened a new way to play
- Law / principle / rule / rule / theorem / axiom / essence / Law
- Output type SPED trigger inbound delivery after PGI for inter-company STO's outb
- DML operation
- Isn't this another go bug?
- Local cache selection (guava/caffeine/ohc) and performance comparison
- How to open Tencent enterprise mailbox and Tencent enterprise mailbox login portal
猜你喜欢

这不会又是一个Go的BUG吧?

The concept of TP FP TN FN in machine learning

ShardingSphere-proxy-5.0.0容量范围分片的实现(五)

Pad User Guide

跨域和JSONP

JS input / output statements, variables

Isn't this another go bug?

GNN上分利器!与其绞尽脑汁炼丹,不如给你的GNN撒点trick吧

Niu Xuechang's anniversary celebration: software promotion, limited time and free registration code!

【Redis进阶之ZipList】如果再有人问你什么是压缩列表?请把这篇文章直接甩给他。
随机推荐
Echo framework: implementing timeout Middleware
DML操作
[ICPR 2021] tiny object detection in aerial images
Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
SAP executes PGI on the delivery order of STO and reports an error -fld selectn for Mvmt type 643 acct 400020 differences
Perhaps the greatest romance of programmers is to commemorate their dead mother with a software
[technical grass planting] use webhook to automatically deploy my blogs on multiple sites in Tencent cloud
持续测试和质量保障的关系
CODING CD
How do small businesses do a good job in website construction? Is there any guarantee for network companies to build websites
什么是养老理财?养老理财产品有哪些?
[shutter] how to use shutter packages and plug-ins
13 `bs_ duixiang. Tag tag ` get a tag object
How to use IOT gateway to realize networking communication of smart road lamp posts
How to build a high-quality website
Why traifik ingress?
What is the cost of domain name trademark registration? What is the use of domain names and trademarks?
Intelligent + fault-tolerant server is the best partner in the edge computing scenario
Zhongshanshan: engineers after being blasted will take off | ONEFLOW u
November 20, 2021: the start and end times of a movie can be listed in a small array