1

I have installed FFA Accounting package in my org and now i have write some code on that, so when i tried to write the Test class so in my condition i want billing contract as active, but when i set the Billing Contract status field active in my test class then i got the error which is 'The status of a contract can only be changed by Billing Central' .

Is anybody aware of this how i can update that as i have checked there is no API defined so i can access that and neither its method are globally define.

2
  • You may need to assign your test user a specific Permission Set; that approach is present in similar packages. FinancialForce support or documentation may help there.
    – David Reed
    Commented Apr 19, 2019 at 19:12
  • Let give a try @DavidReed. Thanks for help.
    – SFDC_USER
    Commented Apr 20, 2019 at 6:05

1 Answer 1

2

There's a global class which allows the activation of Contracts in FinancialForce.
This method does it; pass in the set of contract IDs you want to activate

    public static void activateContracts(set<id> contractsToActivate)
    {
        ffbc.ContractsService.ActivationRequest activationRequest = new ffbc.ContractsService.ActivationRequest();
        activationRequest.ContractIds = contractsToActivate;

        ffbc.ContractsService.ActivationResponse resp = ffbc.ContractsService.activation(activationRequest);
        if (resp.hasErrors())
        {
            // Handle Errors
            string message = '';
            for (id singleErrorId : resp.getErrors().keySet())
            {
                message = message + 'Activation failed for record ' + singleErrorId;
                for (string singleErrorString : resp.getErrors().get(singleErrorId))
                {
                    message = message + singleErrorString + '\n';
                }
            }
            // do something with error message
        }

    }
2
  • Hi Simman, I have tried the same in my test class, It has activate the Billing Contract but I am continuosly facing the the "System.AsyncException: Maximum stack depth has been reached." error. I have used Test.start and Test.stop as well and used try catch as well, but still I am getting the error continue. I didn't understand what is the issue is there.
    – SFDC_USER
    Commented May 15, 2019 at 9:08
  • Have you searched for the error in stack exchange? This post may be helpful: salesforce.stackexchange.com/questions/181233/…
    – Simman
    Commented May 15, 2019 at 22:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .