<?xml version="1.0" encoding="UTF-8"?>
|
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
|
<fullName>ClearStatus</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-22 gwy 版本更改为51.0
|
var foo = function() {
|
|
var result = sforce.connection.query("SELECT Id, Name, Inventory_Status__c FROM Inventory_Header_Copy__c WHERE Id='{!Inventory_Header_Copy__c.Id}' OR Fixture_Header__c = '{!Inventory_Header_Copy__c.Id}'");
|
|
var records = result.getArray("records");
|
for(var i=0;i<records.length;i++){
|
if (records[i].Inventory_Status__c != '处理中'&& records[i].Inventory_Status__c!=null) {
|
alert(records[i].Name+'的盘点状态为【'+records[i].Inventory_Status__c+'】,不能清除此盘点状态。');
|
return;
|
}
|
}
|
if (!confirm("请确认是否要清除盘点状态?")) {
|
return;
|
}
|
|
|
for(var i=0;i<records.length;i++){
|
records[i].Inventory_Status__c = null;
|
}
|
|
var result = sforce.connection.update(records);
|
var messages = getConnectDMLErrorMessages(result);
|
if (messages.length > 0) {
|
alert(messages.join("\n"));
|
return;
|
}
|
window.location.reload();
|
|
}
|
foo();</url>
|
</WebLink>
|