I’m most likely not understanding this problem correctly, so I may be barking up the wrong tree, but I’m going to do my best to explain the problem.
Short Version
How can I poll a Salesforce record until the asynchronous method has completed? I believe I have to use a asynchronous method because I’m calling out to a web service from a trigger and I can only do that with the @future method.
Long Version
I have a Skuid page that is using Stripe Checkout API. I’m using the server-side method by using a custom object called Transaction__c. When the transaction record status equals ‘Process Payment’ it triggers the Apex Class to do a HTTP call to Stripe to start processing the payment.
I have to use a “@future method” to perform the callout since salesforce won’t let me perform a callout from a trigger without making it asynchronous. How can I make the Skuid page wait and keep checking the Salesforce record until it has gone to the correct Status?
I hope this makes sense. I’m in very unfamiliar territory.
Appreciate any help you can give!
Thank you
Page 1 / 1
Hey Sam,
There are 2 community post about the pieces you’ll want here. It’ll tell you how to:
- Query the data via JS - https://community.skuid.com/t/polling-status-from-salesforce-remote-action-and-update-the-components-on-skuid-page
- Set a time interval with JS - https://community.skuid.com/t/real-time-dashboards
- Your Salesforce record reaches a Status of “Done”
- Your Skuid page contains a Transaction model, with condition of Status = “Done” and Id = url parameter (or however you’d like to pass an id). The page continually querys for data until your Transaction model has a single row
- Your Skuid page triggers an action based on that row being updated or created or having data, finishing the process.
And if I mis-represented your issue or need, feel free to clarify further.
Best,
Aaron
Hi Aaron,
Thanks, I ended up using setTimeout() and polled for changes every 5 seconds until it either completed or updated to an error.
If anyone is looking to connect Skuid to Stripe Checkout, this is useful to make sure it goes to the payment collection step.
Thanks!
Sam
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.