I am trying to implement a button that will pass the IDs of the items selected in a detail list to a business process. However, when I try to get the IDs, it says "this.getSelectedItems is not a function".
Any idea on how to fix this issue?
methods: {onNewQuoteClick: function() {
var selectedIds = this.getSelectedItems();
this.showInformationDialog("Heather");
},
getNewQuoteButtonVisible: function() {
this.sandbox.publish("SetNewQuoteButtonVisibility", true, [this.sandbox.id]);
//return result;
return true;
}
},
Like
Hi Heather,
Is this code on the page or in the detail schema? The getSelectedItems is only a function that is available in the detail, not the page. Is this code in the detail?
If you want to get the selected items in the page code, you'd need to use the sandbox to retrieve the selected detail rows from the detail in the page code.
Ryan
Hi Heather,
Is this code on the page or in the detail schema? The getSelectedItems is only a function that is available in the detail, not the page. Is this code in the detail?
If you want to get the selected items in the page code, you'd need to use the sandbox to retrieve the selected detail rows from the detail in the page code.
Ryan
Ryan Farley,
This is in the Page code. Please see the full code below.
define("UsrManifests1Page", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
var config = {
sysProcessName: "UsrResetEmailCache",
parameters: {
SomeProcessParam: "heatherl@corp.pwt.ca"
}
};
ProcessModuleUtilities.executeProcess(config);
return {
entitySchemaName: "UsrManifests",
messages: {
"SetNewQuoteButtonVisibility": {
mode: this.Terrasoft.MessageMode.PTP,
direction: this.Terrasoft.MessageDirectionType.PUBLISH
}
},
attributes: {},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
details: /**SCHEMA_DETAILS*/{
"Files": {
"schemaName": "FileDetailV2",
"entitySchemaName": "UsrManifestsFile",
"filter": {
"masterColumn": "Id",
"detailColumn": "UsrManifests"
}
},
"UsrSchema96dcd22dDetail16ad79d8": {
"schemaName": "UsrSchema96dcd22dDetail",
"entitySchemaName": "UsrPassengers",
"filter": {
"detailColumn": "UsrUsrManifests",
"masterColumn": "Id"
}
},
"UsrStops": {
"schemaName": "UsrSchema00abbfacDetail",
"entitySchemaName": "UsrManifestStops",
"filter": {
"detailColumn": "UsrManifest",
"masterColumn": "Id"
}
}
}/**SCHEMA_DETAILS*/,
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
methods: {onNewQuoteClick: function() {
//TODO: implement your logic here
var selectedIds = UsrStops.getSelectedItems();
this.showInformationDialog("Heather");
},
getNewQuoteButtonVisible: function() {
/*var newMode = this.isNewMode();
var result = !newMode; //TODO: implement your logic for visibility here
*/
this.sandbox.publish("SetNewQuoteButtonVisibility", true, [this.sandbox.id]);
//return result;
return true;
}
},
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "NewQuoteButton",
"values": {
"itemType": 5,
"style": "default",
"caption": {
"bindTo": "Resources.Strings.UsrManifestsSendEmailButton"
},
"click": {
"bindTo": "onNewQuoteClick"
},
"visible": {
"bindTo": "getNewQuoteButtonVisible"
},
"classes": {
"textClass": [
"actions-button-margin-right"
]
}
},
"parentName": "LeftContainer",
"propertyName": "items",
"index": 9
},
{
"operation": "insert",
"name": "UsrName33f1eec2-6c43-46f3-9263-464b14c8828f",
"values": {
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "ProfileContainer"
},
"bindTo": "UsrName",
"enabled": false
},
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "STRING1e5e9a01-15e6-4cdb-b8c0-e471faa21806",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "Header"
},
"bindTo": "UsrJourneyFrom",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "STRING3f76c609-798b-45fc-ab07-387903e4d109",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 0,
"layoutName": "Header"
},
"bindTo": "UsrJourneyFromID",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "STRINGf13e72c4-6d88-43f1-b201-88ec1b9b0a1d",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 1,
"layoutName": "Header"
},
"bindTo": "UsrJourneyTo",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 2
},
{
"operation": "insert",
"name": "STRINGe6c410d2-67e0-4e24-a2fb-03238c8e76c6",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 1,
"layoutName": "Header"
},
"bindTo": "UsrJourneyToID",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 3
},
{
"operation": "insert",
"name": "STRING208798a0-00d8-49bb-ae19-786b0893ecb9",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 2,
"layoutName": "Header"
},
"bindTo": "UsrRoute",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 4
},
{
"operation": "insert",
"name": "STRING09f1c6bf-70bf-4da7-a081-28cb7ef76469",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 2,
"layoutName": "Header"
},
"bindTo": "UsrRouteID",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 5
},
{
"operation": "insert",
"name": "DATETIME61cb3508-b058-41ec-9706-b8a85d5f9b11",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 3,
"layoutName": "Header"
},
"bindTo": "UsrDeparture",
"enabled": true
},
"parentName": "Header",
"propertyName": "items",
"index": 6
},
{
"operation": "insert",
"name": "DATETIMEcba61966-987c-4f8c-8600-d012a8f3e424",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 3,
"layoutName": "Header"
},
"bindTo": "UsrArrival",
"enabled": true
},
"parentName": "Header",
"propertyName": "items",
"index": 7
},
{
"operation": "insert",
"name": "LOOKUP23f48f49-3db0-4d6a-a296-71d3f6c51c33",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 4,
"layoutName": "Header"
},
"bindTo": "UsrBusBrand",
"enabled": true,
"contentType": 3
},
"parentName": "Header",
"propertyName": "items",
"index": 8
},
{
"operation": "insert",
"name": "Tab8ea35db5TabLabel",
"values": {
"caption": {
"bindTo": "Resources.Strings.Tab8ea35db5TabLabelTabCaption"
},
"items": [],
"order": 0
},
"parentName": "Tabs",
"propertyName": "tabs",
"index": 0
},
{
"operation": "insert",
"name": "UsrStops",
"values": {
"itemType": 2,
"markerValue": "added-detail"
},
"parentName": "Tab8ea35db5TabLabel",
"propertyName": "items",
"index": 0
},
{
"operation": "remove",
"name": "ESNTab"
},
{
"operation": "remove",
"name": "ESNFeedContainer"
},
{
"operation": "remove",
"name": "ESNFeed"
},
{
"operation": "remove",
"name": "ChangesHistoryTab"
},
{
"operation": "remove",
"name": "SmrLoggingRecordDetailV2"
}
]/**SCHEMA_DIFF*/
};
});
Ryan Farley,
I read some articles about the sandbox and gave it a try (RowSelectedInStopDetail) but it seems to have crashed my page so I don't think I did it right.
define("UsrManifests1Page", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
var config = {
sysProcessName: "UsrResetEmailCache",
parameters: {
SomeProcessParam: "heatherl@corp.pwt.ca"
}
};
ProcessModuleUtilities.executeProcess(config);
return {
entitySchemaName: "UsrManifests",
messages: {
"SetNewQuoteButtonVisibility": {
mode: this.Terrasoft.MessageMode.PTP,
direction: this.Terrasoft.MessageDirectionType.PUBLISH
}
},
attributes: {},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
details: /**SCHEMA_DETAILS*/{
"Files": {
"schemaName": "FileDetailV2",
"entitySchemaName": "UsrManifestsFile",
"filter": {
"masterColumn": "Id",
"detailColumn": "UsrManifests"
}
},
"UsrSchema96dcd22dDetail16ad79d8": {
"schemaName": "UsrSchema96dcd22dDetail",
"entitySchemaName": "UsrPassengers",
"filter": {
"detailColumn": "UsrUsrManifests",
"masterColumn": "Id"
}
},
"UsrStops": {
"schemaName": "UsrSchema00abbfacDetail",
"entitySchemaName": "UsrManifestStops",
"filter": {
"detailColumn": "UsrManifest",
"masterColumn": "Id"
}
}
}/**SCHEMA_DETAILS*/,
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
methods: {
onNewQuoteClick: function() {
//TODO: implement your logic here
//var selectedIds = this.getSelectedItems();
var selectedIds=getSelected();
this.showInformationDialog("Heather");
},
getNewQuoteButtonVisible: function() {
/*var newMode = this.isNewMode();
var result = !newMode; //TODO: implement your logic for visibility here
*/
this.sandbox.publish("SetNewQuoteButtonVisibility", true, [this.sandbox.id]);
//return result;
return true;
},
rowSelected: function() {
this.sandbox.publish("RowSelectedInStopDetail", { test: "TEST!!" }, [this.sandbox.id]);
//console.log("rowSelected in Stop detail...");
},
getSelected: function() {
this.sandbox.subscribe("RowSelectedInStopDetail", function(arg) {
console.log("test " + arg.test);
}, this, [this.getSenderSandboxId()]);
}
},
messages: {
"RowSelectedInStopDetail": {
mode: Terrasoft.MessageMode.PTP,
direction: Terrasoft.MessageDirectionType.PUBLISH
}
},
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "NewQuoteButton",
"values": {
"itemType": 5,
"style": "default",
"caption": {
"bindTo": "Resources.Strings.UsrManifestsSendEmailButton"
},
"click": {
"bindTo": "onNewQuoteClick"
},
"visible": {
"bindTo": "getNewQuoteButtonVisible"
},
"classes": {
"textClass": [
"actions-button-margin-right"
]
}
},
"parentName": "LeftContainer",
"propertyName": "items",
"index": 9
},
{
"operation": "insert",
"name": "UsrName33f1eec2-6c43-46f3-9263-464b14c8828f",
"values": {
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "ProfileContainer"
},
"bindTo": "UsrName",
"enabled": false
},
"parentName": "ProfileContainer",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "STRING1e5e9a01-15e6-4cdb-b8c0-e471faa21806",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "Header"
},
"bindTo": "UsrJourneyFrom",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "STRING3f76c609-798b-45fc-ab07-387903e4d109",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 0,
"layoutName": "Header"
},
"bindTo": "UsrJourneyFromID",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 1
},
{
"operation": "insert",
"name": "STRINGf13e72c4-6d88-43f1-b201-88ec1b9b0a1d",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 1,
"layoutName": "Header"
},
"bindTo": "UsrJourneyTo",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 2
},
{
"operation": "insert",
"name": "STRINGe6c410d2-67e0-4e24-a2fb-03238c8e76c6",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 1,
"layoutName": "Header"
},
"bindTo": "UsrJourneyToID",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 3
},
{
"operation": "insert",
"name": "STRING208798a0-00d8-49bb-ae19-786b0893ecb9",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 2,
"layoutName": "Header"
},
"bindTo": "UsrRoute",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 4
},
{
"operation": "insert",
"name": "STRING09f1c6bf-70bf-4da7-a081-28cb7ef76469",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 2,
"layoutName": "Header"
},
"bindTo": "UsrRouteID",
"enabled": false
},
"parentName": "Header",
"propertyName": "items",
"index": 5
},
{
"operation": "insert",
"name": "DATETIME61cb3508-b058-41ec-9706-b8a85d5f9b11",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 3,
"layoutName": "Header"
},
"bindTo": "UsrDeparture",
"enabled": true
},
"parentName": "Header",
"propertyName": "items",
"index": 6
},
{
"operation": "insert",
"name": "DATETIMEcba61966-987c-4f8c-8600-d012a8f3e424",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 12,
"row": 3,
"layoutName": "Header"
},
"bindTo": "UsrArrival",
"enabled": true
},
"parentName": "Header",
"propertyName": "items",
"index": 7
},
{
"operation": "insert",
"name": "LOOKUP23f48f49-3db0-4d6a-a296-71d3f6c51c33",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 4,
"layoutName": "Header"
},
"bindTo": "UsrBusBrand",
"enabled": true,
"contentType": 3
},
"parentName": "Header",
"propertyName": "items",
"index": 8
},
{
"operation": "insert",
"name": "Tab8ea35db5TabLabel",
"values": {
"caption": {
"bindTo": "Resources.Strings.Tab8ea35db5TabLabelTabCaption"
},
"items": [],
"order": 0
},
"parentName": "Tabs",
"propertyName": "tabs",
"index": 0
},
{
"operation": "insert",
"name": "UsrStops",
"values": {
"itemType": 2,
"markerValue": "added-detail",
"selectRow": {
"bindTo": "rowSelected"
}
},
"parentName": "Tab8ea35db5TabLabel",
"propertyName": "items",
"index": 0
},
{
"operation": "remove",
"name": "ESNTab"
},
{
"operation": "remove",
"name": "ESNFeedContainer"
},
{
"operation": "remove",
"name": "ESNFeed"
},
{
"operation": "remove",
"name": "ChangesHistoryTab"
},
{
"operation": "remove",
"name": "SmrLoggingRecordDetailV2"
}
]/**SCHEMA_DIFF*/
};
});
Heather,
I realized that I had duplicated the messages section in my code. I have posted a follow up to this issue.
getSelected is not defined trying to work with Sandbox | Community Creatio