From fd9df05c48c09b4d7f39a3b401882bda226dedea Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 31 十月 2023 20:38:18 +0800
Subject: [PATCH] 近期修改
---
force-app/main/default/classes/OpportunityLightingButtonController.cls | 55 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index d20d964..6ed5047 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
* @Author: chen jing wu
* @Date: 2023-04-12 11:16:07
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-10-19 16:29:00
+ * @LastEditTime: 2023-10-26 20:30:06
*/
public with sharing class OpportunityLightingButtonController {
@AuraEnabled
@@ -600,7 +600,7 @@
update opp;
return null;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ return errorMessage(e);
}
}
@AuraEnabled
@@ -612,7 +612,7 @@
update opp;
return null;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ return errorMessage(e);
}
}
@AuraEnabled
@@ -626,7 +626,7 @@
update opp;
return null;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ return errorMessage(e);
}
}
@AuraEnabled
@@ -642,7 +642,7 @@
update opp;
return null;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ return errorMessage(e);
}
}
@AuraEnabled
@@ -772,7 +772,7 @@
processResults.add(Approval.process(request));
return processResults[0].errors;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ return errorMessage(e);
}
}
@AuraEnabled
@@ -786,7 +786,18 @@
];
return user.Id;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ if (e.getMessage().contains(',')) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ String exc = '' + e.getMessage();
+ Integer left = exc.indexOf(':') + 1;
+ Integer right = exc.lastIndexOf(':');
+ String str = exc.substring(left,right);
+ left = str.indexOf(',') + 1;
+ String newStr = str.substring(left);
+ return newStr;
+ }else {
+ return e.getMessage();
+ }
}
}
@AuraEnabled
@@ -800,7 +811,18 @@
];
return pro.Id;
} catch (Exception e) {
- return e.getDmlMessage(0);
+ if (e.getMessage().contains(',')) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ String exc = '' + e.getMessage();
+ Integer left = exc.indexOf(':') + 1;
+ Integer right = exc.lastIndexOf(':');
+ String str = exc.substring(left,right);
+ left = str.indexOf(',') + 1;
+ String newStr = str.substring(left);
+ return newStr;
+ }else {
+ return e.getMessage();
+ }
}
}
@AuraEnabled
@@ -945,7 +967,7 @@
return '1';
} catch (Exception ex) {
Database.rollback(sp);
- return ex.getDmlMessage(0);
+ return errorMessage(ex);
}
}
@AuraEnabled
@@ -967,6 +989,21 @@
}
return false;
}
+
+ public static string errorMessage(Exception e){
+ if (e.getMessage().contains(',')) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ String exc = '' + e.getMessage();
+ Integer left = exc.indexOf(':') + 1;
+ Integer right = exc.lastIndexOf(':');
+ String str = exc.substring(left,right);
+ left = str.indexOf(',') + 1;
+ String newStr = str.substring(left);
+ return newStr;
+ }else {
+ return e.getMessage();
+ }
+ }
public class InitData{
@AuraEnabled
--
Gitblit v1.9.1