高章伟
2022-03-10 8db20630a2675ca14e03ccdee91c614397b5c964
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>NewAgencyHospital</fullName>
    <availability>online</availability>
    <displayType>massActionButton</displayType>
    <linkType>javascript</linkType>
    <masterLabel>新建经销商医院</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <requireRowSelection>false</requireRowSelection>
    <url>{!REQUIRESCRIPT(&quot;/soap/ajax/51.0/connection.js&quot;)};
{!REQUIRESCRIPT(&quot;/soap/ajax/51.0/apex.js&quot;)};
//2021-10-22 gwy 版本更改为51.0
var doubleFlg = false;
if(!doubleFlg) {
    doubleFlg = true;
    var query = &quot;Select Id From RecordType Where DeveloperName = &apos;AHospital&apos; And SobjectType = &apos;Agency_Hospital_Link__c&apos;&quot;;
    var records = sforce.connection.query(query).getArray(&apos;records&apos;);
    var rtId = records[0].Id;
    query = &quot;Select EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = &apos;Agency_Hospital_Link__c&apos; And QualifiedApiName = &apos;Agency__c&apos;&quot;;
    records = sforce.connection.query(query).getArray(&apos;records&apos;);
    var prefix = records[0].EntityDefinition.KeyPrefix.toString();
    var fId_Agency__c = records[0].DurableId.toString().substr(16, 15);
    var newUrl = &quot;/&quot; + prefix + &quot;/e?retURL=%2F{!Account.Id}&quot; + 
        &quot;&amp;Name=*&quot; +
        &quot;&amp;CF&quot; + fId_Agency__c + &quot;={!URLENCODE(Account.Name)}&quot; +
        &quot;&amp;CF&quot; + fId_Agency__c + &quot;_lkid={!Account.Id}&quot;;
    if (window.top == window.self) {
        location.href = newUrl;
    } else {
        top.location.href = newUrl;
    }
}</url>
</WebLink>