| | |
| | | //判断insert or update |
| | | function ProcessPI(caseJson, payloadForNewPI) { |
| | | blockme(); |
| | | if ({!isNewMode}) { |
| | | if ({!isNewMode} || {!isCloneMode}) { |
| | | NewPIToAWS(caseJson, payloadForNewPI) |
| | | }else { |
| | | UpdatePIToAWS(caseJson, payloadForNewPI) |
| | |
| | | console.log(nodelist[index].id.indexOf('lkwgt')); |
| | | if (nodelist[index].id.indexOf('lkwgt') == -1) { |
| | | let vlookUpNodeId = nodelist[index].id + '_lkid'; |
| | | if (nodelist[index].getAttribute("data-id") == 'Field1_staff__c') { |
| | | vlookUpNodeId = nodelist[index].id.substring(0,nodelist[index].id.length-4) + '_lkid'; |
| | | } |
| | | let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; |
| | | result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; |
| | | } |
| | |
| | | index++; |
| | | } |
| | | } |
| | | //针对id的手动添加 |
| | | if (document.getElementById("page:form:block:j_id31:0:j_id32:j_id33:1:j_id34_lkid") && (!result.hasOwnProperty("Field1_staff__c") || !result["Field1_staff__c"])){ |
| | | if(document.getElementById("page:form:block:j_id31:0:j_id32:j_id33:1:j_id34_lkid").value != '000000000000000'){ |
| | | result["Field1_staff__c"] = document.getElementById("page:form:block:j_id31:0:j_id32:j_id33:1:j_id34_lkid").value; |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | |
| | | //需要解密字段 |
| | | var queryBack = function queryBack(data) { |
| | | console.log('data = ' + data); |
| | | if (document.querySelector("[data-id='cic_telephone__c']")) { |
| | | document.querySelector("[data-id='cic_telephone__c']").value = data.object.cicTelephone; |
| | | } |
| | | if (document.querySelector("[data-id='CASE_CUSTOMER__c']")) { |
| | | document.querySelector("[data-id='CASE_CUSTOMER__c']").value = data.object.caseCustomer; |
| | | } |
| | | if (document.querySelector("[data-id='Customer_manual__c']")) { |
| | | document.querySelector("[data-id='Customer_manual__c']").value = data.object.customerManual; |
| | | } |
| | | }; |
| | | |
| | | var insertOrUpdateBack = function insertOrUpdateBack(payloadJson, result, isNewMode) { |
| | |
| | | payloadJson.Customer_manual_Encrypted__c = r.object[0].customerManualEncrypt; |
| | | //payloadJson.AWS_Data_Id__c = r.object[0].dataId; |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | | if (isNewMode) { |
| | | if (isNewMode || {!isCloneMode}) { |
| | | payloadJson.AWS_Data_Id__c = r.object[0].dataId; |
| | | } else { |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | |
| | | //1. Get Case Information from Form |
| | | let caseJson = getCaseInformation(); |
| | | //2. Validate the Case field value formate, for example the email formate or phone formate |
| | | /* |
| | | let validationResultMessage = validateFieldValueFormate(); |
| | | console.log(validationResultMessage); |
| | | if (!validationResultMessage) { |
| | |
| | | alertErrorMessage('手机格式输入有误,请重新输入!'); |
| | | return |
| | | } |
| | | */ |
| | | // Check Required Field |
| | | let checkRequiredFieldMsgResult = checkRequiredFieldMsg(caseJson); |
| | | if (checkRequiredFieldMsgResult) { |