1

We have implemented a custom functionality where we created an apex web-service and have hosted it on force.com sites. The functionality creates a lead if email is found , and if account is present it creates an opportunity. This was working fine before the release in all sandboxes as well as production but now its throwing a null pointer exception.

Below is a small snippet of it.

List<Id> ownerIds = new List<Id>{};
        for(Opportunity opp : opps){

            ownerIds.add(opp.OwnerId);
        }
        system.debug('ownerIds'+ownerIds);
        list<user> m=[SELECT Id,UserRole.Name
                                FROM User where id =:ownerIds];
                                
        system.debug('User list '+m);

This list was returning values before but now its not returning. This snippet exists in opportunity trigger and as trigger runs in system mode, it should return value in the list .

1
  • The SOQL looks wrong... try WHERE Id IN :ownerIds
    – Phil W
    Jul 21 '20 at 6:59

Your Answer

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

Browse other questions tagged or ask your own question.