Google apps script Google脚本在放置多个条件时出错
我已经粘贴了下面的示例 代码:Google apps script Google脚本在放置多个条件时出错,google-apps-script,Google Apps Script,我已经粘贴了下面的示例 代码: 函数ck(){ //分配变量 var ss=SpreadsheetApp.getActiveSpreadsheet(); var sheet=ss.getActiveSheet(); var lastrow=ss.getLastRow(); var valsr7=sheet.getRange(lastrow,3.getValue(); var valsr30=sheet.getRange(lastrow,4.getValue(); var valsrn=sheet
函数ck(){
//分配变量
var ss=SpreadsheetApp.getActiveSpreadsheet();
var sheet=ss.getActiveSheet();
var lastrow=ss.getLastRow();
var valsr7=sheet.getRange(lastrow,3.getValue();
var valsr30=sheet.getRange(lastrow,4.getValue();
var valsrn=sheet.getRange(lastrow,5.getValue();
var valINC7=sheet.getRange(lastrow,6.getValue();
var valINC30=sheet.getRange(lastrow,7.getValue();
var valINCn=sheet.getRange(lastrow,8.getValue();
var service=sheet.getRange(lastrow,2.getValue();
var now=新日期();
var wk=now.getWeek();
//现在为变量赋值
var A=VALR7;
var B=VALR30;
var C=valsrn;
var D=有效7;
var E=有效期30;
var F=有效值;
var AB=AB;
if(service='Global-Servicenow-Support-T2'&&A==0&&B==0){
MailApp.sendmail({
致:“prathamesh.padosakar。ext@lafargeholcim.com",
主题:“公开门票全球-C&k-T2-周-“+wk+”,
htmlBody:“亲爱的ABC,”+
“未分配给任何一个=“+C+””+
“   ”+“+
“未更新超过7天=“+D+””+
未更新超过30天=“+E+”“+
“未分配给任何一个=“+F+””+
“   ”+“+
“致以最良好的祝愿,”+
“
全球服务台”+,
抄送:“技术。pratham94@gmail.com"})
}
if(service='Global-Servicenow-Support-T2'&&A==0){
MailApp.sendmail({
致:“prathamesh.padosakar。ext@lafargeholcim.com",
主题:“公开门票全球-C&k-T2-周-“+wk+”,
htmlBody:“亲爱的ABC,”+
“未更新超过30天=“+B+””+
“未分配给任何一个=“+C+””+
“
   ”+“+
“未更新超过7天=“+D+””+
未更新超过30天=“+E+”“+
“未分配给任何一个=“+F+””+
“   ”+“+
“致以最良好的祝愿,”+
“
全球服务台”+,
抄送:“技术。pratham94@gmail.com"
});
}
否则{
}
如果(服务=='Global-Servicenow-Support-T2'&&B==0){
MailApp.sendmail({
致:“prathamesh.padosakar。ext@lafargeholcim.com",
主题:“公开门票全球-C&k-T2-周-“+wk+”,
htmlBody:“亲爱的ABC,”+
未更新超过7天=“+A+”“+
“未分配给任何一个=“+C+””+
“
   ”+“+
“未更新超过7天=“+D+””+
未更新超过30天=“+E+”“+
“未分配给任何一个=“+F+””+
“   ”+“+
“致以最良好的祝愿,”+
“
全球服务台”+,
抄送:“技术。pratham94@gmail.com"
});
}
否则{
}
当我通过if(service=='Global-Servicenow-Support-T2'&&A==0)
和if(service=='Global-Servicenow-Support-T2'&&B==0)
传递条件时,它给我单一输出或正确输出。当我通过条件if(service=='Global-Servicenow-Support-T2'&&A==0&&B==0)
它给出了下面提到的所有3个条件的输出
if(service=='Global-Servicenow-Support-T2'&A==0)
和if(service=='Global-Servicenow-Support-T2'&B==0)
和if(service=='Global-Servicenow-Support-T2'&A==0&B==0)
当我通过条件if(service=='Global-Servicenow-Support-T2'&&A==0&&B==0)时,请帮助我想要单输出
if(service == 'Global-Servicenow-Support-T2' && A == 0){
if(service == 'Global-Servicenow-Support-T2' && B == 0){
到
改变现状
if(service == 'Global-Servicenow-Support-T2' && A == 0){
if(service == 'Global-Servicenow-Support-T2' && B == 0){
到
然后,如果(service=='Global-Servicenow-Support-T2'&&A==0&&B==0)
if(service == 'Global-Servicenow-Support-T2' && B == 0 && A != 0){