| force-app/main/default/classes/LexCICInputSolutionController.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexCustomClone/lexCustomClone.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexNewCICContact/lexNewCICContact.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexNewCICContact/lexNewCICContact.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexNewCICContact/lexNewCICContact.js-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
force-app/main/default/classes/LexCICInputSolutionController.cls
New file @@ -0,0 +1,42 @@ public with sharing class LexCICInputSolutionController { @AuraEnabled public static List<Case> initCICInputSolution(String recordId) { return [Select Id,inquiry_detail__c,answer_detail_content__c from Case Where Id = :recordId]; } @AuraEnabled public static InitCustomCloneData initCustomClone(String recordId) { InitCustomCloneData customCloneData = new InitCustomCloneData(); String caseRecordType = [select Id,DeveloperName from RecordType where SobjectType = 'Case' and DeveloperName = 'CICRecordType'].Id; customCloneData.caseRecordType = caseRecordType; customCloneData.caseList = [Select Id,inquiry_detail__c,answer_detail_content__c from Case Where Id = :recordId]; return customCloneData; } @AuraEnabled public static InitNewCICContactData initNewCICContact(String recordId) { InitNewCICContactData initNewCICContactData = new InitNewCICContactData(); String contactRecordType = [select Id,DeveloperName from RecordType where SobjectType = 'Contact' and DeveloperName = 'Agency'].Id; String caseRecordType = [select Id,DeveloperName from RecordType where SobjectType = 'Case' and DeveloperName = 'CICRecordType'].Id; initNewCICContactData.contactRecordType = contactRecordType; initNewCICContactData.caseRecordType = caseRecordType; List<Contact> contactList = [select id, Account.Id,Account.Parent_Parent__c ,RecordTypeId from Contact where Id= :recordId]; initNewCICContactData.contactList = contactList; return initNewCICContactData; } public class InitNewCICContactData{ @AuraEnabled public String contactRecordType; @AuraEnabled public String caseRecordType; @AuraEnabled public List<Contact> contactList; } public class InitCustomCloneData{ @AuraEnabled public String caseRecordType; @AuraEnabled public List<Case> caseList; } } 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)} force-app/main/default/lwc/lexNewCICContact/lexNewCICContact.html
New file @@ -0,0 +1,5 @@ <template> <div class="Holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexNewCICContact/lexNewCICContact.js
New file @@ -0,0 +1,99 @@ import { LightningElement, track, wire, api } from 'lwc'; import { CurrentPageReference } from 'lightning/navigation'; import { NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/LexCICInputSolutionController.initNewCICContact'; export default class lexNewCICContact extends LightningElement { IsLoading = true; @api recordId; initData = {}; def_account_id = ''; RecordType = ''; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ // this.recordId ='0030l00000wy2IgAAI'; init({ recordId: this.recordId }).then(result => { if (result != null) { console.log(result); this.initData = result; if(result !=null) { if(result.contactList.length>0) { if(result.contactList[0].RecordTypeId == result.contactRecordType) { this.def_account_id = result.contactList[0].Account.Id; } else { this.def_account_id = result.contactList[0].Account.Parent_Parent__c; } } this.RecordType = result.caseRecordType; } this.cancelSubmit().then(res=>{ this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }); } }).catch(error => { console.log(error); }) } async cancelSubmit(){ // this.navigateToNewObjectPage(); window.open('/apex/NewAndEditCase?retURL='+this.recordId+'&def_contact_id='+this.recordId+'&def_account_id='+this.def_account_id+'&RecordType='+this.RecordType); } navigateToNewObjectPage() { alert(); const defaultFieldValues =encodeDefaultFieldValues({ retURL: this.recordId, def_contact_id: this.recordId, def_account_id: this.def_account_id, RecordType: this.RecordType }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Case', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultFieldValues } }); this.dispatchEvent(new CloseActionScreenEvent()); } } //old js // /500/e?retURL=%2F{!Contact.Id}&def_contact_id={!Contact.Id}& // def_account_id={!IF(Contact.RecordTypeId='01210000000QfWi',Account.Id,Account.Parent_Parent__c)} // &RecordType=01210000000QsYp&ent=Case //01210000000QfWi: select Id,DeveloperName from RecordType where SobjectType = 'Contact' and DeveloperName = 'Agency' //01210000000QsYp: select Id,DeveloperName from RecordType where SobjectType = 'Case' and DeveloperName = 'CICRecordType' force-app/main/default/lwc/lexNewCICContact/lexNewCICContact.js-meta.xml
New file @@ -0,0 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCreateOnCALLFromAsset"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <target>lightningCommunity__Page_Layout</target> </targets> </LightningComponentBundle>