李彤
2022-05-30 115b1ebc6e433315a9835af24d4fe0f90343a3ca
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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ASRC_Editor</fullName>
    <availability>online</availability>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>Intake universal code编辑</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!REQUIRESCRIPT(&quot;/soap/ajax/51.0/connection.js&quot;)}; 
{!REQUIRESCRIPT(&quot;/soap/ajax/51.0/apex.js&quot;)}; 
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)}
//2021-10-21 gwy 版本更改为51.0
var foo = function() {
   var RecordTypeId = &quot;ASRCDecision&quot;;
   var RepairId = &quot;{!Repair__c.Id}&quot;;
    //RecordType.DeveloperName= + &apos;&quot;+ RecordTypeId  + &quot;&apos; 
   var sql = &quot;SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Repair__c = &apos;&quot; + RepairId + &quot;&apos; And RecordType.DeveloperName = &apos;&quot;+ RecordTypeId +&quot;&apos; Order by LastModifiedDate desc&quot;;
   var newRCPAED_IdList = sforce.connection.query(sql);
   var records = newRCPAED_IdList.getArray(&quot;records&quot;); 
   var url = &apos;&apos;;
   
   if (records.length&gt;0){
       url = &quot;/apex/PAEDecisionRecord?Id=&quot;+records[0].Id+&quot;&amp;RepairId=&quot;+RepairId +&quot;&amp;RecordTypeIds=&quot;+RecordTypeId ;
   } else {
      url = &quot;/apex/PAEDecisionRecord?RepairId=&quot;+RepairId +&quot;&amp;RecordTypeIds=&quot;+RecordTypeId;
   }
   window.open(url,&apos;_self&apos;);
}
foo();</url>
</WebLink>