function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WalidWalid 

Calling an Apex method from a Flow fails!

Hi there,

I built a Visual Flow that finishes with calling an Apex method. The Flow is being launched from the Field Service Lightning mobile App, but when it tries to execute the Apex method, it fails with the error:
Error uploading: Irresolvable failure.
Invalid Action Type:
AP03c_sendToZuoraList
The Flow is a simple one that does some changes to the Work Order Line Item, and the last action is to call this method.

Here is how I am calling the method from within the flow:
User-added image

And here is the code of the method:
public class AP03c_sendToZuoraList {
    @InvocableMethod
    public static void SendToZuora(List<id> opportunityidList) {
         
        Id opportunityid = opportunityidList[0];
        
        List < zqu__Quote__c > zquotesList = [SELECT id, zqu__Opportunity__r.accountId, name, zqu__Customer_Acceptance_Date__c, zqu__Service_Activation_Date__c, zqu__SubscriptionName__c, zqu__BillCycleDay__c, zqu__ZuoraSubscriptionNumber__c
                                              FROM zqu__Quote__c
                                              WHERE zqu__Opportunity__r.id = : opportunityid];
        
        
        List<zqu.zQuoteUtil.ZBillingQuoteCollection> quotes = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();
        
        zqu.zQuoteUtil.ZBillingQuoteCollection quote = new zqu.zQuoteUtil.ZBillingQuoteCollection();
        quote.sfdcAccountId = zquotesList[0].zqu__Opportunity__r.accountId; // SFDC CRM Account ID
        quote.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();
        for(zqu__Quote__c quoteToSend : zquotesList){
            zqu.zQuoteUtil.ZBillingQuoteRequest req = new zqu.zQuoteUtil.ZBillingQuoteRequest();
            req.sfdcQuoteId = quoteToSend.Id; // SFDC Quote ID
            quote.quoteRequests.add(req);
        }
        quote.zAccountId = 'new'; // Zuora Billing Account ID

        quotes.add(quote);

        List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.sendToZBilling(quotes);
        
        for ( zqu.zQuoteUtil.zBillingResult result : results ) {
            System.debug('Result: QuoteId = ' + result.sfdcQuoteId + ', Success = ' + result.success + ', message = ' + result.message );
        }
    }
}

Any suggestions?

Thanks!



 
WalidWalid
For anyone having the same issue, please note that Apex methods CANNOT be called from within the FSL App. This was the reason for my error.
Workaround would be to use Platform Events to kick off the method.

Regards,
Walid