liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference,NavigationMixin } from "lightning/navigation";
import selectQuoteById  from '@salesforce/apex/LexQuoteSelectbottonController.selectQuoteById';
import SIopprecordTypeId from '@salesforce/label/c.SIopprecordTypeId';
 
export default class LexQuoteEntryEditBottonLwc extends NavigationMixin(LightningElement){
    @api recordId;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
            console.log(currentPageReference);
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
            console.warn("str");
            console.warn(str);
            this.recordId = str;
          }
        }
    }
    connectedCallback(){
        console.warn('recordId'+this.recordId);
        debugger
        selectQuoteById({recordId:this.recordId}).then(result=>{
            var RecordTypeid = result.Opportunity.RecordTypeId;
            if(RecordTypeid.substr(0, 15) == SIopprecordTypeId){
                // window.open('/apex/SI_NewQuoteEntry?Id={!URLENCODE(Quote.Id)}');
                window.open('/lightning/n/lexSINewQuoteEntry#Id='+result.Id,'_self');
            }else{
                window.open('/lightning/n/lexNewQuoteEntry#Id='+result.Id,'_self');
            // window.open('/apex/NewQuoteEntry?Id={!URLENCODE(Quote.Id)}');
            }
        });
    }
}