0
Follow
0
View

Redirect to Dashboard by embedding Dashboard URL inside LWC

cuiguoxing2008 注册会员
2023-01-25 19:40

After formatting the code, it appears pretty obvious there is an issue with concatenation. Please try to always format correctly your code, this help avoid a lot of errors.

Concatenation between variable and static string can be achieve in several ways:

// Basic using + operator
this.URL = this.a_Record_URL + '/desktopDashboards/dashboardApp.app?dashboardId=01Z4y000001O93MEAS&displayMode=view&networkId=000000000000000';

// Using backtick
this.iframeURL = `${this.a_Record_URL}/desktopDashboards/dashboardApp.app?dashboardId=01Z4y000001O93MEAS&displayMode=view&networkId=000000000000000`;

// Using array
this.iframeURL = [
  this.a_Record_URL,
  '/desktopDashboards/dashboardApp.app?dashboardId=01Z4y000001O93MEAS&displayMode=view&networkId=000000000000000'
].join('')
daitingting0123 注册会员
2023-01-25 19:39

Don't include the base domain if you want to show only dashboard in a custom component. check out this one.

HTML


JS

@track height = '870px';
@track iframeURL= '';
@track width = '100%';

 @wire(getRecord, {
    recordId: "$recordId",
    fields
})
loadFields({error, data}){
  if(data){                                
this.iframeURL = '/desktopDashboards/dashboardApp.app? 
dashboardId=01Z4y000001O93MEAS&displayMode=view&networkId=000000000000000';    
}

About the Author

Question Info

Publish Time
2023-01-25 19:39
Update Time
2023-01-25 19:39