function delegateSlotCollection(){
console.log("current dialogState: "+this.event.request.dialogState);
if (this.event.request.dialogState === "STARTED") {
var updatedIntent=this.event.request.intent;
this.emit(":delegate", updatedIntent);
} else if (this.event.request.dialogState !== "COMPLETED") {
console.log("in not completed");
if(this.event.request.intent.slots.customername.value) {
let prompt = "Please Tell Me your Item name ";
let reprompt = "";
console.log("Printed");
this.emit(':elicitSlot', 'item', prompt, reprompt);
}
} else {
return this.event.request.intent;
}
}
After running this code it ask for customer name after that it elicits item value and after that when i enter item value it goes in a loop and again and again ask item value how to break this ?
output json :-
"directives": [ { "type": "Dialog.ElicitSlot", "slotToElicit": "item" } ],
function delegateSlotCollection(){
console.log("current dialogState: "+this.event.request.dialogState);
if (this.event.request.dialogState === "STARTED") {
var updatedIntent=this.event.request.intent;
this.emit(":delegate", updatedIntent);
} else if (this.event.request.dialogState !== "COMPLETED") {
console.log("in not completed");
if (this.event.request.intent.slots.item.value) {
this.emit(":delegate");
}
else if(this.event.request.intent.slots.customername.value) {
let prompt = "Please Tell Me your Item name HELLO ";
let reprompt = "";
console.log("Printed");
this.emit(':elicitSlot', 'item', prompt, reprompt);
}
} else {
return this.event.request.intent;
}
}
Okay Found This Solution It Worked