We added the link using a View Dashboard icon. This icon shows when you hover over a record in any entity list (for example, Customers, Prospects, Leads, which you can view in List > Relationship). When you click the icon, it will direct you to a Dashboard page for that particular record.
The following steps show how to add the View Dashboard icon which will link an entity record with the corresponding Dashboard to a list in a Suitelet:
Add a View Dashboard Icon
- Create a Transaction Body Field:
- Go to Customization > Lists, Records, & Fields > Transaction Body Fields > New.
- In Basic Information fill in the following fields:
- In Label, enter: Dashboard.
- In Image ID , enter: _dashboard_image.
- In Type, select: Free-Form Text.
- in Store Value: don’t check the box.
- In Validation & Defaulting tab fill in the following fields:
- In Default Value, enter: ‘<img src=”/images/nav/ns_x.gif” height=”13″ width=”16″ border=”0″ title=”View Dashboard” class=”i_dashboard_gray”>’.
- In Formula: check the box.
- Click Save.
- Deploy Suitelet script:
- Create a JavaScript file named “SuiteletDashboard.js” with the following code:
/**
- @NApiVersion 2.x
- @NScriptType Suitelet
- @NModuleScope SameAccount
*/
define([“N/ui/serverWidget”,”N/search”],
function(serverWidget,search) {
function demoList(context) {
var list = serverWidget.createList({
title: ‘Simple List’
});
list.style = context.request.parameters.style;
var column = list.addColumn({
id: ‘custbody_dashboard_image’,
label: ‘Dashboard’,
type: serverWidget.FieldType.TEXT,
align: serverWidget.LayoutJustification.LEFT
});
column.setURL({
url:”https://system.netsuite.com/app/center/card.nl?sc=-69″ //URL of a Dashboard
});
column.addParamToURL({
param: ‘entityid’,
value: ‘entity’,
dynamic: true // the dynamic parameter that allows to link the URL of a Dashboard with the corresponding entity
});
list.addColumn({
id: ‘trandate’,
label: ‘date’,
type: serverWidget.FieldType.DATE,
align: serverWidget.LayoutJustification.LEFT
});
list.addColumn({
id: ‘name_display’,
label: ‘Customer’,
type: serverWidget.FieldType.TEXT,
align: serverWidget.LayoutJustification.LEFT
});
list.addColumn({
id: ‘salesrep_display’,
label: ‘Sales Rep’,
type: serverWidget.FieldType.TEXT,
align: serverWidget.LayoutJustification.LEFT
});
list.addColumn({
id: ‘amount’,
label: ‘Amount’,
type: serverWidget.FieldType.CURRENCY,
align: serverWidget.LayoutJustification.RIGHT
});
var searchEstimate = search.create({
type: search.Type.ESTIMATE,
filters: [{
name: 'mainline',
operator: 'is',
values: ['T']
}],
columns: [{
name: 'trandate'
}, {
name: 'entity'
}, {
name: 'name'
}, {
name: 'salesrep'
}, {
name: 'amount'
}, {
name: 'custbody_dashboard_image' // Dashboard link
}],
});
var searchEstimateResults = searchEstimate.run();
var results = searchEstimateResults.getRange({
start: 0,
end: 1000
});
list.addRows({
rows: results
});
context.response.writePage({
pageObject: list
});
}
return {
onRequest: demoList
};
});
- Go to Customization > Scripting > Scripts > New.
- Click +.
- Upload JavaScript file from Step 1.
- Click the Create Script Record button.
- In Basic Information, in the Name field, enter: View Dashboard Suitelet.
- In Deployments tab, enter:
- Title: View Dashboard Suitelet
- Status: Released
- Click Save.