Li Jun
2022-04-08 ac719375874fd50fad5a11f8e04ac3329081bd0b
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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>specSubmit</fullName>
    <availability>online</availability>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>提交审批</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-22 gwy 版本更改为51.0
var foo = function() {
 
  var reason = &apos;{!OpportunitySpecialApply__c.Apply_Reason__c}&apos;; 
  var file = &apos;{!OpportunitySpecialApply__c.Is_upload_file__c}&apos;;
  var status = &apos;{!OpportunitySpecialApply__c.Status__c}&apos;;
 
  if((reason == &apos;招标质疑&apos;||reason == &apos;取消招标&apos;)  &amp;&amp; (file == false)){
    alert(&apos;请上传附件。&apos;);
    return;
  }
  if(status != &apos;草案中&apos;&amp;&amp; status != &apos;驳回&apos;){
    alert(&apos;当前状态无法提交审批。&apos;);
    return;
  }
 
  if (!confirm(&quot;一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?&quot;)) {
    return;
  }
 
  var spec = new sforce.SObject(&apos;OpportunitySpecialApply__c&apos;); 
 
  spec.Id = &apos;{!OpportunitySpecialApply__c.Id}&apos;; 
  spec.Status__c = &apos;已提交&apos;;
 
  var result = sforce.connection.update([spec]); 
  var messages = getConnectDMLErrorMessages(result); 
 
  if (messages.length &gt; 0) { 
  alert(messages.join(&quot;\n&quot;)); 
  return; 
    } 
  alert(&apos;审批提交成功。&apos;); 
  window.location.reload();
};
foo();</url>
</WebLink>