Matt,
I'm assuming the "Slot" is one of the columns in your outbound calling list records, is that correct? Your original nested IF statement should work just fine, and if it is reaching the "Confirm_ApptSlot_1to5" then that tells me that the column value must not contain the value in the format that you are checking for. Can you confirm that the rows in your calling list contain the "Slot" value formatted like you are checking for? Perhaps the "(Slot X)" at the end of the time range string isn't really there in the calling list.
Also, if it were me, I would try to eliminate the IF statements completely and instead try to use a series of "Replace" statements to convert the "Slot" value in the calling list directly into the name of the prompt. For instance something like this:
Task.timeslot = Call.Contact.Slot <-- Task.timeslot will contain "9:00am - 11:00am (Slot A)" from the calling list
Task.timeslot = Replace(Task.timeslot, " ", NOT_SET) // Remove spaces. Task.timeslot will contain "9:00am-11:00am(Slot A)"
Task.timeslot = Replace(Task.timeslot, "am", NOT_SET) // Remove 'am'. Task.timeslot will contain "9:00-11:00(Slot A)"
Task.timeslot = Replace(Task.timeslot, "pm", NOT_SET) // Remove 'pm'. Task.timeslot will contain "9:00-11:00(Slot A)"
Task.timeslot = Replace(Task.timeslot, ":00", NOT_SET) // Remove ':00'. Task.timeslot will contain "9-11(Slot A)"
Task.timeslot = Replace(Task.timeslot, ":30", "30") // Remove the ":" before a '30'. Task.timeslot will contain "9-11(Slot A)"
Task.timeslot = Replace(Task.timeslot, "Noon", "12") // Convert 'Noon' to '12'. Task.timeslot will contain "9-11(Slot A)"
Task.timeslot = Replace(Task.timeslot, "-", "to") // Convert '-' to 'to'. Task.timeslot will contain "9to11(Slot A)"
Task.timeslot = Split(Task.timeslot, "(")[0] <-- // Remove the '(SlotX)' part of the string. Task.timeslot will contain "9to11"
Task.timeslot = "Confirm_ApptSlot_" + Task.timeslot // Prepend the prompt prefix to create the prompt name. Task.timeslot will contain "Confirm_ApptSlot_9to11"
At this point you have a variable, Task.timeslot, that should contain the formatted prompt name that you can supply directly to FindUserPrompt(Task.timeslot). You can debug this in your callflow by using a "Play Audio" block to speak the value of Task.timeslot to confirm that you've built the string correctly, and remove that "Play Audio" block once your done with your debugging and ready for production. And your call flow should be easier to read because you can do all of the string manipulation in a single "Update Data" block that contains as many update statements as you need to manipulate the string.
I hope that helps a little.
------------------------------
Jim Crespino
Senior Director, Developer Evangelism
Genesys
https://developer.genesys.com------------------------------
Original Message:
Sent: 02-09-2023 15:30
From: Matt Hargis
Subject: Outbound call flows and nested If statements in expression editor
I've come across an issue trying to expand a variable expression in an existing outbound call flow that was created a few years ago, at the time this call flow only required a choice between two different timeslots so a single If statement was sufficient:
If(Call.Contact.Slot=="8am-12pm",FindUserPrompt("Confirm_ApptSlot_8to12"),FindUserPrompt("Confirm_ApptSlot_1to5"))
The issue comes when trying to expand this expression with multiple If statements to accommodate more timeslots, the below expression saves without error however when running a contact list the expression ignores the "9:00am - 11:00am (Slot A)" and instead uses the "Confirm_ApptSlot_1to5" TTS prompt. If i remove the "FindUserPrompt("Confirm_ApptSlot_1to5")" section the expression throws an error: Error at position 389. (At the end of the last ")" in the nested statement)
If(Call.Contact.Slot=="9:00am - 11:00am (Slot A)",FindUserPrompt("Confirm_ApptSlot_9to1130"),
If(Call.Contact.Slot=="Noon - 2:30pm (Slot B)",FindUserPrompt("Confirm_ApptSlot_12to230"),
If(Call.Contact.Slot=="3:00pm - 5:30pm (Slot C)",FindUserPrompt("Confirm_ApptSlot_3to530"),
If(Call.Contact.Slot=="6:00pm - 8:30pm (Slot D)",FindUserPrompt("Confirm_ApptSlot_6to830"),FindUserPrompt("Confirm_ApptSlot_1to5")
)
)
)
)
Support suggested i use the following but the "Task.timeslot" variable throws an error as well: The variable reference 'Task.timeslot' at position 6 is not valid.
If
(Task.timeslot=="8am-12pm",FindUserPrompt("Confirm_ApptSlot_8to12"),
If
(Task.timeslot=="9am-1130pm",FindUserPrompt("Confirm_ApptSlot_9to1130"),
If
(Task.timeslot=="12pm-230pm",FindUserPrompt("Confirm_ApptSlot_12to230"),
If
(Task.timeslot=="3pm-530pm",FindUserPrompt("Confirm_ApptSlot_3to530"),
If
(Task.timeslot=="6pm-830pm",FindUserPrompt("Confirm_ApptSlot_6to830"),FindUserPrompt("Confirm_ApptSlot_1to5")
)
)
)
)
)
Any ideas would be helpful as i am in the process of engaging Genesys Professional Services and it might take a few days, but i would like to solve this sooner and without expenditure if possible.
#ArchitectureandDesign
------------------------------
Matt Hargis
SEEL, LLC
------------------------------