1

I'm trying to create CPQ Quote(Steelbrick) from Community user through @RemoteAction method.

It fails with error

Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SBQQ.QuoteAfter: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object Class.SBQQ.QuoteService.processTriggerAft

The class with remote action is declared as without sharing, so I assume it should run in system context. But if I execute quote creation using 'execute anonymous' in dev console, it creates a cpq quote.

In debug logs I see that the following query returns zero rows:

SELECT OwnerId,AccountId,Pricebook2Id,SBQQ__Renewal__c,
       Account.SBQQ__ContractCoTermination__c,
       Account.SBQQ__CoTerminationEvent__c,CurrencyIsoCode,
       (SELECT Id FROM SBQQ__Quotes2__r) 
FROM Opportunity 
WHERE Id IN ('00618000004n5gaAAA')

but If I run it in query editor it returns me one row. How it's possible if the code should run in system mode?

The code in the @RemoteAction method looks like this:

SBQQ__Quote__c quote = new SBQQ__Quote__c(
    SBQQ__Opportunity2__c = opportunityId,
    SBQQ__Account__c = accountId,
    SBQQ__PrimaryContact__c = contactId,
    SBQQ__Status__c = 'Draft',
    SBQQ__Primary__c = true,
    SBQQ__StartDate__c = today,
    SBQQ__EndDate__c = today.addDays( 30 ),
    SBQQ__PriceBook__c = pricebookId
);

insert quote;

1 Answer 1

1

Your user will still need to have a license to have a quote created. Changing the sharing settings doesn't change that

You must log in to answer this question.

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