I use the Form Saved event to send a message via Whatsapp with the details of the amount paid and the balance of a fee. The problem is that sometimes it sends it correctly other times it doesn't. I deduce that it is because the event does not actually wait for the save to finish, but rather fires when the save button is pressed. In any case, the columns that I use are the amount paid, which is filled in by the client, or left with the Init Value and the Balance, which is calculated by subtracting the amount minus the amount paid. Those data are already in the Form.
I need help understanding what is happening and how to fix it.
I attach an image of the message sent, immediately accepting the event confirmation box, and another one sent after saving the data with a Display Overlay Button of the same action.
You can base your action on the data change instead of button press, that is you could have two separate actions. The button action will save the form, and another action will send the message based on addition of a new row or the update of the row columns.
Actually the idea is that automatically when saving, it asks the user if he wants to send the receipt by whatsapp, anyway, there is a button to resend it later. But not doing it at save time can make the user forget to send it later.
Anyway, my question points to how the appsheet sequence works, if both actions (Save and OpenUrl) are triggered in parallel when saving, or is it a sequence. When the Form "Saved" event is called, I understand that the OpenUrl action is fired after having finished saving. In addition, there are no child records, so the information already calculated should be sent without problems.
The second action should launch automatically based on data change, and would not require further user intervention.
Currently when the user saves a form you have an action based on this save. This action will ask the user if he would like to send the receipt AND it will trigger sending the receipt.
Instead, this is the proposed scenario:
I'm trying to implement your solution, but I'm running into some obstacles:
1. I can not assign the ResetFlag option, since Send Confirmation does not have that option (This is not a problem because it was already 0 as initial value)
2. The bot that monitors the SendFlag change does not support an OpenURL action. Although it is created, it does not appear in the Run a data action list. If I want to Create New action, there is no option: "External: go to a website"
What I can be doing wrong?
1. Added SendFlag column
2. Create both SetFlag and Reset Flag actions.
3. I assigned SetFlag to the FormSaved event.
4. Create the action (I actually copied the OpenURL action from the system)
5. I added the bot that monitors SendFlag but I can't assign the OpenURL action to it and I understand that next I should also fire the ResetFlag action, so that it returns to 0.
Thanks for your answer, but it didn't work.
I attach images: In the bahavior section the action accepts OpenURL, but when selecting it in the bot, the referenced action disappears.
To understand what was not working, I added a second ResetFlag action to the bot, to see if the bot passed by, and yes, it sets the flag to 1 and then sets it to 0, but in between it never opens the URL.
In the bot you will not find openURL, you should instead add launchOpenURL. I tested it successfully.
By the way, I understand that your URL is what you use to send a Whatsapp msg, like: https://wa.me/number/?text=someText
Otherwise, if your URL points to a viewable webpage for example, then yes the view won't open when launched by a bot.
Exactly, this is the expression I use:
HYPERLINK("https://api.whatsapp.com/send?phone=549"&
[Cliente Id].[Formatear Whatsapp]&
"&text="&
"*------------ Recibo Cuota Nยบ "&[Cuota Nยบ]&" ------------*%0A%0A"&
"Buenos dรญas "&[Cliente Id].[NyA]&" te envio el comprobante de la cuota:%0A%0A"&
"*Fecha:* "&TEXT(TODAY(),"dd mmm yyyy")&"%0A"&
"*Vencimiento:* "&TEXT([Fecha de Vencimiento],"dd mmm yyyy")&"%0A"&
"*Importe Cuota:* "&TEXT([Importe])&"%0A"&
"*Punitorios:* "&TEXT([Punitorios])&"%0A"&
"*Abonado.:* "&TEXT([Importe abonado])&"%0A"&
"*Saldo Cuota:* "&TEXT([Saldo])&"%0A"&
&"%0A%0A"&
"-----------------------------------------------------------%0A"
&"แดฐแตหขแตสณสณแตหกหกแตแตแต แตแตสณ แตแตหกแตโฟแตแตแตแตแตหข แถแตแต แตสณ"
In the bot I select the action called: "Enviar Recibo de Cuota x Whatsapp" which would be the one you call: "launchOpenURL", which is configured like this:
Do this - Data: execute an action on a set of rows
Referenced table: the same table
Referenced rows: LIST([_THISROW])
Referenced action: openURL. In the bot, this action is not seen in the second image
You are on the right track. Just put the same action "Enviar Recibo de Cuota x Whatsapp" in the Referenced Action field below. You will find it.
There is something I can't understand. The panel on the right is the detail of the selected action. If the referenced action is the same action, it calls itself. Anyway, I did the test and it kept saving, until I killed it, and it never reached the ResetFlag action, which tells me that it got stuck inside that action.
One:
Two:
Three:
I can't get it to work.
I configured Display Overlay for the New Action, and if I run it from the button it opens the Whatsapp app and sends the message, but from the bot it doesn't do anything. I thank you and apologize for so much inconvenience. I attach images of the actions to see if you see what is wrong.
No problem my friend ๐
Would you please show the trigger part of your bot?
The bot works, because if I add another step after New Action and assign ResetFlag to it, the bot sets the flag back to 0, which means that it was executed.
The last I can think of:
1. Try to remove the condition. I donโt think it is needed here. Put it inside the action that contains the URL.
2. Try to insert a step that will send an email to your app creator email.
3. Check the log in the bot monitor and see if it gives any clues.
Iโm sorry ๐ maybe others can help.
The problem is undoubtedly in the OpenUrl, as it is triggered by the bot. since the same action triggered by the bot, when triggered by hand with the button, works fine, and any other action triggered by the bot also works.
What surprises me is that you told me that you tried it successfully. Could you share your test to compare?
Give us your column description, pls.
//I think, that you are use fields, calculated outside AppSheets ๐
If you mean calculated fields in the spreadsheet, this is not the case. Everything is calculated in appsheet. What there is, and it has brought me several inconveniences is that the Paid Amount field has an Initial Value calculated according to several conditions, to avoid the user having to write it by hand in most cases, so if pay the total amount simply press save. Apparently, if no one writes, although the value is saved, it is not taken into account in the calculations, nor does it fire the ChangeTimeStamp event (although the value with respect to the saved changes) and I suspect that is why it does not update that value in the WhatsApp message, which is nothing more than a url concatenated with all the values within the message.
User | Count |
---|---|
36 | |
32 | |
30 | |
18 | |
16 |