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.

| improve this question | | | | |
  • 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 Apr 19 '19 at 19:12
  • Let give a try @DavidReed. Thanks for help. – SFDC_USER Apr 20 '19 at 6:05

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

| improve this answer | | | | |
  • 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 May 15 '19 at 9:08
  • Have you searched for the error in stack exchange? This post may be helpful: salesforce.stackexchange.com/questions/181233/… – Simman May 15 '19 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.