• PDA Group
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Application:

We need to read customer check-in time at certain scheduled time. 
Customer will use fingerprint as check-in method.(3rd party fingerprint read device)
We use Apex method to make web service callout to read their checkin time. 
After we read their check-in time, We will update corresponding field in customer's record.

Objects:

Here, it will involve two objects. CCSS Object and Timer object.
CCSS Object record will store basic information about customer, we need customer check-in time information from here.
Then, we create a record in Timer object which will use check-in time from CCSS Object.

When the Timer record was created (only when a record is created), it will start a Process Builder to schedule a Process (scheduled action).
This Process will start at customer check-in time (0 Hours After customer check-in time) to call CustomerPunchTime Apex method (web service callout).

CustomerPunchTime Apex method is using following structure.

@InvocableMethod is for PB to see the apex and pass variables.
@future(callout=true) is for web service callout.

Current Problem:

If two customer have same check-in time, there will have two the scheduled actions starting at same time.
Those two actions will run without at issue. The issue is only one action will have its apex method started.
The other one will not start its apex method at all. For sure, they are calling same apex at same time.

For example, two scheduled actions started at 6:00PM, I can only see one web service callout was made on Developer Console Logs panel.
I can confirm that only one process started its apex, the other one never enter its apex.

I don't think it should use Queueable Apex because the other process never started.

Please let me know if you need more info.
Application:

We need to read customer check-in time at certain scheduled time. 
Customer will use fingerprint as check-in method.(3rd party fingerprint read device)
We use Apex method to make web service callout to read their checkin time. 
After we read their check-in time, We will update corresponding field in customer's record.

Objects:

Here, it will involve two objects. CCSS Object and Timer object.
CCSS Object record will store basic information about customer, we need customer check-in time information from here.
Then, we create a record in Timer object which will use check-in time from CCSS Object.

When the Timer record was created (only when a record is created), it will start a Process Builder to schedule a Process (scheduled action).
This Process will start at customer check-in time (0 Hours After customer check-in time) to call CustomerPunchTime Apex method (web service callout).

CustomerPunchTime Apex method is using following structure.

@InvocableMethod is for PB to see the apex and pass variables.
@future(callout=true) is for web service callout.

Current Problem:

If two customer have same check-in time, there will have two the scheduled actions starting at same time.
Those two actions will run without at issue. The issue is only one action will have its apex method started.
The other one will not start its apex method at all. For sure, they are calling same apex at same time.

For example, two scheduled actions started at 6:00PM, I can only see one web service callout was made on Developer Console Logs panel.
I can confirm that only one process started its apex, the other one never enter its apex.

I don't think it should use Queueable Apex because the other process never started.

Please let me know if you need more info.
I have 2 future calls. The first creates a record in our accounting software via call out.

I then use another future method to create an invoice in the accounting software and pass it the customer ID returned from the first future method.

I have created 2 seperate apex classes. Both are invocable processes. When a status changes on the opportunity I use process builder to fire the first call to create the customer record. Which creates a customer record related to the account.

When a customer record is created I use process builder to fire the second invocable process to create the invoice.

I am getting the error 'Future Method cannot be called from future or batch method.' 

I can't understand why if I can call the first future method from process builder, and it has finished (as a customer record is created) then why can't I call the second future method from process builder also?