Li Jun
2022-04-25 784f9cec56eef3c7ac0ba02de98fdbf341c6a7b3
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ConsumApply_FromRA</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;)}
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)}
//2021-10-22 gwy 版本更改为51.0
function foo(){
    if(&apos;{!$User.isFormal_Stuff__c}&apos;==&apos;true&apos;){
        alert(&apos;试用期内,不能申请&apos;);
    } else {
        var query = &quot;Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = &apos;Consum_Apply__c&apos;&quot;; 
        var records = sforce.connection.query(query).getArray(&apos;records&apos;);
 
        var prefix =  records[0].EntityDefinition.KeyPrefix.toString();
        var fieldmap = new Map();
 
        for (var i=0; i&lt; records.length; i++) {
            var record = records[i];
            fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split(&apos;.&apos;)[1]);
        }
        var demo_purpose2__c = &apos;{!CASE(TEXT(Rental_Apply__c.demo_purpose2__c),
                                   &apos;试用(有询价)&apos;,&apos;OPD试用&apos;,
                                   &apos;试用(无询价)&apos;,&apos;OPD试用&apos;,
                                   &apos;学会展会&apos;,&apos;学会展会&apos;,
                                   &apos;索赔QIS&apos;,&apos;索赔QIS&apos;,
                                   &apos;&apos;)}&apos;;
 
        var url = &quot;{!$Site.Prefix}/&quot; + prefix + &quot;/e?retURL=%2F{!URLENCODE(Rental_Apply__c.Id)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Rental_Apply__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Name)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Rental_Apply__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.Id)}&quot;
 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Campaign__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Campaign__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Campaign__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.CampaignId__c)}&quot;
 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;QIS_number__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.QIS_number__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;QIS_number__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.QIS_numberId__c)}&quot;
 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;QISRepair__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.QISRepair__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;QISRepair__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.QISRepairId__c)}&quot;
 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;OPD__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.OPD__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;OPD__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.OPDId__c)}&quot; 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;OPDPlan__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.OPDPlan__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;OPDPlan__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.OPDPlanId__c)}&quot; 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Hospital__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Hospital__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Hospital__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.HospitalId__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Strategic_dept__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Strategic_dept__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Strategic_dept__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.Strategic_deptId__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Account__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Account__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Account__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.AccountId__c)}&quot;
 
                + &quot;&amp;Name={!URLENCODE(&apos;*&apos;)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;demo_purpose2__c&apos;) + &quot;=&quot;+demo_purpose2__c
                + &quot;&amp;&quot; + fieldmap.get(&apos;ApplyPerson_Phone__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.ApplyPerson_Phone__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;Phone_number__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Phone_number__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;Request_shipping_day__c&apos;) + &quot;={!Rental_Apply__c.Request_shipping_day__c}&quot;
 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Loaner_medical_Staff__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Loaner_medical_Staff__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Loaner_medical_Staff__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.Loaner_medical_StaffId__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Person_In_Charge__c&apos;) + &quot;={!URLENCODE($User.LastName&amp;&apos; &apos;&amp;$User.FirstName)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Person_In_Charge__c&apos;) + &quot;_lkid={!URLENCODE($User.Id)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;applyUser__c&apos;) + &quot;={!URLENCODE($User.LastName&amp;&apos; &apos;&amp;$User.FirstName)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;applyUser__c&apos;) + &quot;_lkid={!URLENCODE($User.Id)}&quot;
                //发送信息
 
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Shipment_address__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Shipment_address__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Shipment_address__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.Shipment_addressId__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Dealer__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Dealer__c)}&quot;
                + &quot;&amp;CF&quot; + fieldmap.get(&apos;Dealer__c&apos;) + &quot;_lkid={!URLENCODE(Rental_Apply__c.DealerId__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;direct_send__c&apos;) + &quot;={!TEXT(Rental_Apply__c.direct_send__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;pickup_time__c&apos;) + &quot;={!Rental_Apply__c.pickup_time__c}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;Loaner_received_staff__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Loaner_received_staff__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;Loaner_received_staff_phone__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Loaner_received_staff_phone__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;Post_Code__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.Post_Code__c)}&quot;
                + &quot;&amp;&quot; + fieldmap.get(&apos;direct_shippment_address__c&apos;) + &quot;={!URLENCODE(Rental_Apply__c.direct_shippment_address__c)}&quot;
 
                + &quot;&quot;;
        window.top.location.href=url;
    }
}
foo();</url>
</WebLink>