zhangzhengmei
2023-08-07 5f8c97f8716088019ad9a0302c5dea461bc668b1
force-app/main/default/lwc/lexCustomClone/lexCustomClone.js
@@ -3,15 +3,17 @@
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init  from '@salesforce/apex/CaseController.initForlexCustomCloneButton';
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
import { updateRecord } from 'lightning/uiRecordApi';
// import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
import init from '@salesforce/apex/LexCICInputSolutionController.initCustomClone';
// import { updateRecord } from 'lightning/uiRecordApi';
export default class lexCustomClone extends LightningElement {
   @api recordId;
   IsLoading = true;
   inquirydetail;
   answerdetailcontent;
    RecordType;
   @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -34,16 +36,39 @@
            recordId: this.recordId
        }).then(result => {
            this.IsLoading = false;
            this.inquirydetail = result.inquirydetail;
            this.answerdetailcontent = result.answerdetailcontent;
            var url = "/500/e?retURL="+this.recordId+"&RecordType=01210000000QsYp&ent=Case"+
                  "&00N10000003M4vA="+this.inquirydetail+
                  "&00N10000003M4v8="+this.answerdetailcontent;
            window.open(url);
            if (result != null) {
                console.log(result);
                this.initData = result;
                if(result !=null) {
                    if(result.caseList.length>0) {
                        this.inquirydetail = result.caseList[0].inquiry_detail__c;
                        this.answerdetailcontent = result.caseList[0].answer_detail_content__c;
                    }
                    this.RecordType = result.caseRecordType;
                }
            }
            this.cancelSubmit().then(res=>{
                this.IsLoading=false;
                this.dispatchEvent(new CloseActionScreenEvent());
            });
      //       var url = "/500/e?retURL="+this.recordId+"&RecordType=01210000000QsYp&ent=Case"+
                  // "&00N10000003M4vA="+this.inquirydetail+
                  // "&00N10000003M4v8="+this.answerdetailcontent;
      //       window.open(url);
        }).catch(error => {
            console.log('error='+error);
        }).finally(() => {
            
        }); 
    }
    async cancelSubmit(){
        // window.open('/apex/NewAndEditCase?retURL='+this.recordId+'&RecordType='+this.RecordType+'&inquiry_detail__c='+this.inquirydetail+'&answer_detail_content__c='+this.answerdetailcontent);
        window.open('/apex/NewAndEditCase?retURL='+this.recordId+'&RecordType='+this.RecordType+'&inquiry_detail__c='+this.inquirydetail+'&answer_detail_content__c='+this.answerdetailcontent);
    }
}
//oldjs
// /500/e?retURL={!Case.Id}&RecordType=01210000000QsYp&ent=Case
// &00N10000003M4vA={!HTMLENCODE(Case.inquiry_detail__c)}
// &00N10000003M4v8={!HTMLENCODE(Case.answer_detail_content__c)}