Should the event.common.filterInputs stay intact across multiple sequential dialogs? Or is there a way to ensure that they are persistent vs overwritten on card/dialog change?
function startPOC(event) {
try {
return {
action_response: {
type: "DIALOG",
dialog_action: {
dialog: {
body: {
sections: [
{
header: "POC Setup",
widgets: [
{
textInput: {
label: "Name of Company",
type: "SINGLE_LINE",
name: "nameOfCompany",
//value: defaultValues.nameOfCompany,
},
},
{
textInput: {
label: "Name of Contact",
type: "SINGLE_LINE",
name: "nameOfContact",
//value: defaultValues.nameOfContact,
},
},
{
textInput: {
label: "Contact Email",
type: "SINGLE_LINE",
name: "contactEmail",
//value: defaultValues.contactEmail,
},
},
{
selectionInput: {
type: "CHECK_BOX",
label: "Selected Products",
name: "selectedProducts",
items: [
{
text: "Product 1",
value: "product1",
},
{
text: "Product 2",
value: "product2",
},
],
},
},
{
buttonList: {
buttons: [
{
text: "Next",
onClick: {
action: {
function: "documentsNeededDialog",
},
},
},
],
},
},
],
},
],
},
},
},
},
};
} catch (error) {
console.error("Error in startPOC:", error);
return createErrorMessageDialog(
"An error occurred. Please try again later."
);
}
}
the log from the below console.log is, This is what I expect
documentsNeededDialog try { nameOfRep: { '': { stringInputs: [Object] } },
nameOfCompany: { '': { stringInputs: [Object] } },
contactEmail: { '': { stringInputs: [Object] } },
nameOfContact: { '': { stringInputs: [Object] } },
selectedProducts: { '': { stringInputs: [Object] } } }
function documentsNeededDialog(event) {
console.log("documentsNeededDialog try", event.common.formInputs);
try {
// Get the selected products from the event parameters
var documentsNeeded = getDocumentsNeeded(event.common.formInputs.selectedProducts[""].stringInputs.value);
console.log(documentsNeeded)
return {
action_response: {
type: "DIALOG",
dialog_action: {
dialog: {
body: {
sections: [
{
header: "Documents Needed for POC",
widgets: [
{
selectionInput: {
type: "CHECK_BOX",
label: "Select Documents:",
name: "selectedDocuments",
items: documentsNeeded.map((document) => ({
text: document,
value: document,
selected: false,
})),
},
},
{
buttonList: {
buttons: [
{
text: "Next",
onClick: {
action: {
function: "productSpecificDialog",
},
},
},
],
},
},
],
},
],
},
},
},
},
};
} catch (error) {
console.error("Error in documentsNeededDialog:", error);
return createErrorMessage();
} finally {
console.log("documentsNeededDialog finally", event.common.formInputs);
}
}
the log from above console.log is, Also expected:
documentsNeededDialog finally { nameOfRep: { '': { stringInputs: [Object] } },
nameOfCompany: { '': { stringInputs: [Object] } },
contactEmail: { '': { stringInputs: [Object] } },
nameOfContact: { '': { stringInputs: [Object] } },
selectedProducts: { '': { stringInputs: [Object] } } }
Then we go into the next sequential dialog
the log from the below console.log is:
Debug productSpecificDialog try { selectedDocuments: { '': {stringInputs: [Object] } } }
which is missing the previous user stringInputs, only showing selectedDocuments which were changed in previous dialog so I can't access them to do anything with them.
function productSpecificDialog(event) {
console.log("productSpecificDialog try", event.common.formInputs)
try {
// Get the user's responses from the event object
const userResponses = event.common.formInputs;
Hoping that in further cards I can display different items based on what responses they gave in first dialog.
But apparently I'm missing something to make it persistent.
my onCardClick is good and my document selection based on products selected works, just can't seem to get the user responses to persist past 1 dialog.