<?xml version="1.0" encoding="UTF-8"?>
|
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
|
<fullName>Submit_For_Approval</fullName>
|
<availability>online</availability>
|
<displayType>button</displayType>
|
<linkType>javascript</linkType>
|
<masterLabel>提交待审批</masterLabel>
|
<openType>onClickJavaScript</openType>
|
<protected>false</protected>
|
<url>{!RequireScript("/soap/ajax/51.0/connection.js")}
|
{!RequireScript("/soap/ajax/51.0/apex.js")}
|
{!RequireScript("/resource/CommonUtilJs")}
|
//2021-10-21 gwy 版本更改为51.0
|
var foo = function() {
|
if('{!SolutionProjectRequirements__c.Status__c}' == '07结案'){
|
alert('已结案');
|
return;
|
}
|
if('{!SolutionProjectRequirements__c.Submit_Date_YouWant__c}' < '{!DATEVALUE( SolutionProjectRequirements__c.CreatedDate +3)}'){
|
alert('希望提交日期不得小于三天,如紧急需求请邮件联络Solution担当');
|
return;
|
}
|
var attachments = sforce.connection.query("select id,Department_Class__r.OwnerId,Department_Class__r.Owner.SalesManager__c from Account where id = '{!SolutionProjectRequirements__c.Department_ClassId__c}'");
|
var records= attachments.getArray("records");
|
//alert(records[0].Department_Class__r.OwnerId+'====={!CASESAFEID($User.Id)}');
|
//alert(records[0].Department_Class__r.Owner.SalesManager__c +'====={!CASESAFEID($User.Id)}');
|
|
var header = '{!SolutionProjectRequirements__c.Product_Leader__c}';
|
var usrname = '{!$User.Name__c}';
|
var rtn = '';
|
rtn = sforce.apex.execute("SolutionProjectUtil", "getName", {header:header,usrname:usrname});
|
//alert(rtn);
|
//alert('{!SolutionProjectRequirements__c.Product_Leader__c}');
|
if(records.length > 0){
|
if(rtn != 'Y' && '{!CASESAFEID($User.Id)}' != records[0].Department_Class__r.OwnerId && '{!CASESAFEID($User.Id)}' != records[0].Department_Class__r.Owner.SalesManager__c){
|
alert('只允其战略科室主担、产品担当及省经理提交solution项目需求!');
|
return;
|
}
|
}
|
if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
|
return;
|
}
|
|
|
//window.$Label = window.$Label || {};
|
//$Label.customLabel= '{!($Label.ProfileId_SystemAdmin)}';
|
//var label = $Label.customLabel;
|
|
sforce.connection.sessionId = "{!$Api.Session_ID}";
|
var isopd = new sforce.SObject("SolutionProjectRequirements__c");
|
isopd.Id = "{!SolutionProjectRequirements__c.Id}";
|
isopd.Submint_TF__c = true;
|
isopd.Submitter__c = "{!$User.Id}";
|
try {
|
var result = sforce.connection.update([isopd]);
|
var messages = getConnectDMLErrorMessages(result);
|
if (messages.length > 0) {
|
alert(messages.join("\n"));
|
return;
|
}
|
} catch (err) {
|
if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
|
alert('当前网页已登出,请您重新登录后刷新该网页!');
|
} else {
|
alert(err.faultstring);
|
}
|
return;
|
}
|
|
window.location.reload();
|
};
|
foo();</url>
|
</WebLink>
|