From 4238b5408fde989099dc289e4f830ac3c1a0a6d3 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期三, 11 五月 2022 17:04:57 +0800
Subject: [PATCH] Page Enhance 0511

---
 force-app/main/default/pages/NewOnCall.page |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page
index 232d675..2b17d5b 100644
--- a/force-app/main/default/pages/NewOnCall.page
+++ b/force-app/main/default/pages/NewOnCall.page
@@ -37,8 +37,10 @@
         var queryBack = function queryBack(data) {
             console.log('data = ' + data);
             //document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").value = data.object.callerPhone;
-            document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone;    //20220404  By Chen Yanan
-            document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP;
+            if(document.getElementById(api_id_map['Caller_phone__c']))
+                document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone;    //20220404  By Chen Yanan
+            if(document.querySelector("[data-id='Responsible_Person_HP__c']"))
+                document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP;
             unblockUI();
         };
 
@@ -59,6 +61,9 @@
                 delete payloadJson.OwnerId;
             } else {
                 payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
+            }
+            if('{!sfRecordIdForEdit}'){
+                payloadJson.Id = '{!sfRecordIdForEdit}';
             }
             if('{!rtTypeId}'){
                 payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421
@@ -146,7 +151,7 @@
         //Insert Sensitive Information to AWS
         function NewPIToAWS(onCallJson, payloadForNewPI) {
             let controllerSaveMethod = '{!$RemoteAction.OnCallController.saveOnCall}';
-            AWSService.insert(staticResources.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack, redirectCallBack);
+            AWSService.insert(staticResources.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl,{!isNewMode}, insertOrUpdateBack, redirectCallBack);
         }
 
         //Check Required Fields

--
Gitblit v1.9.1