Reputation: 79
I am using a waterfall method which will create a service request for me. In the first step of waterfall, i am showing the list of herocards as carousel for service request creation.
const srCarousel = [
CardFactory.heroCard('Application Service Request',
CardFactory.images(['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg']),
CardFactory.actions([
{ type: 'postBack',
title: 'Application Service Request',
value: 'Create Application Service Request'
}])),
CardFactory.heroCard('Virtual Desktop Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Virtual Desktop Service Request']),
CardFactory.heroCard('Generic Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Generic Service Request'])
];
const message = MessageFactory.carousel(srCarousel);
return await stepContext.context.sendActivity(message);
The above code is first function in my waterfall method. However when i invoke this dialog. I am getting the carousel card in emulator but the bot is moving to final step instead of next prompt. Could anyone please assist. I even tried with action type as postback , messageBack . it didn't work out for me.
Update :
My complete Waterfall dialog step :
class CreateServiceRequestDialog extends CancelAndHelpDialog {
constructor(id) {
super(id || 'createServiceRequestDialog');
// this.IncReq = new IncReq('int_user', 'Admin@123');
this.addDialog(new TextPrompt(TEXT_PROMPT))
.addDialog(new ConfirmPrompt(CONFIRM_PROMPT))
.addDialog(new ChoicePrompt(CHOICE_PROMPT))
.addDialog(new DateResolverDialog(DATE_RESOLVER_DIALOG))
.addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
this.serviceRequestTypes.bind(this),
this.classifySRDialog.bind(this)
// this.incidentCreation.bind(this)
]));
this.initialDialogId = WATERFALL_DIALOG;
}
async serviceRequestTypes(stepContext) {
const srTypes = stepContext.options;
console.log('INSIDE SR TYPES');
console.log(srTypes);
if (!srTypes.srTypes) {
const srCarousel = [
CardFactory.heroCard('Application Service Request',
CardFactory.images(['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg']),
CardFactory.actions([
{ type: 'postBack',
title: 'Application Service Request',
value: 'Create Application Service Request'
}])),
CardFactory.heroCard('Virtual Desktop Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Virtual Desktop Service Request']),
CardFactory.heroCard('Generic Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Generic Service Request'])
];
const message = MessageFactory.carousel(srCarousel);
return await stepContext.context.sendActivity(message);
}
}
async classifySRDialog(stepContext) {
stepContext.values.classifiedSR = stepContext.result;
console.log(stepContext.values.classifiedSR );
if (stepContext.values.classifiedSR === 'Create Generic Service Request') {
const promptOptions = { prompt: 'Can you describe your service request in short' };
return await stepContext.prompt(TEXT_PROMPT, promptOptions);
} else if (stepContext.values.classifiedSR === 'Create Application Service Request') {
console.log('Inside Application SR');
// Begin Dialog of application service request
} else if (stepContext.values.classifiedSR === 'Create Virtual Desktop Service Request') {
// Begin VDI dialog
} else {
// end Dialog
}
}
}
module.exports.CreateServiceRequestDialog = CreateServiceRequestDialog;
Upvotes: 0
Views: 55
Reputation: 6368
Changing the following code should fix your issue.
Correct this:
return await stepContext.context.sendActivity(message);
to this:
await stepContext.context.sendActivity(message);
return { status: DialogTurnStatus.waiting };
Hope of help!
Upvotes: 1