123
chenjingwu
2024-04-15 65a3de8fc057c6550f38d2aef6b5ed7f0e7e2f81
force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-05-15 11:14:32
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-04 13:16:23
 * @LastEditTime: 2023-09-21 17:13:37
 */
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -13,6 +13,8 @@
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP from '@salesforce/label/c.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class LexAssignTaskButton extends NavigationMixin(LightningElement) {
    @api recordId;
    accountName;
@@ -35,6 +37,9 @@
         }
     }
     connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
           ]);
        init({
            recordId: this.recordId
        }).then(result=>{
@@ -75,17 +80,25 @@
            taskDifferent__c: '上级分配任务',
            Name: '*'
        });
        let states =
                {
                    nooverride: '1',
                    navigationLocation: 'LIST_VIEW',
                    // backgroundContext: '/lightning/o/Account/list?filterName=Recent&0.source=alohaHeader',
                    backgroundContext: '/lightning/r/Opportunity/'+this.recordId+'/view',
                    defaultFieldValues: defaultValues,
                };
            // states['recordTypeId'] =  this.recordTypeId;
        states['useRecordTypeCheck'] =  true;
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'task__c',
                actionName: 'new'
            },
            state: {
                nooverride: '1',
                defaultFieldValues: defaultValues,
                recordTypeId: this.recordTypeId
            }
            state: states
        });
        this.dispatchEvent(new CloseActionScreenEvent());
     }