Skip to main content
Nintex Community Menu Bar
Question

How to poll Salesforce Record until future callout is completed and record has changed


Forum|alt.badge.img+9

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  

Translate
Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

Forum|alt.badge.img+1

Hey Sam,

There are 2 community post about the pieces you’ll want here. It’ll tell you how to:

  1. Query the data via JS - https://community.skuid.com/t/polling-status-from-salesforce-remote-action-and-update-the-components-on-skuid-page
  2. Set a time interval with JS - https://community.skuid.com/t/real-time-dashboards
I believe this is how this could look:
  1. Your Salesforce record reaches a Status of “Done”
  2. 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
  3. Your Skuid page triggers an action based on that row being updated or created or having data, finishing the process.
Best of luck! Transactions are a tricky business. Feel free to post progress/road blocks as they come. 🙂

And if I mis-represented your issue or need, feel free to clarify further.

Best,
Aaron

Translate

Forum|alt.badge.img+9
  • Author
  • 111 replies
  • July 11, 2024

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

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings