2

I have a post install script which schedules a batch apex. After installation of the package the jobs are getting scheduled but scheduled apex fails to execute scheduled jobs. It says dependent class is invalid and needs recompilation.

enter image description here

Here is the stack trace

Apex script unhandled exception by user/organization: 005xxxxxxxxx/00Dxxxxxxxx

Scheduled job 'FeedItem Delete Scheduled Job 40' threw unhandled exception.

caused by: line 3, column 44: Dependent class is invalid and needs recompilation: SPARTADMS.DMSFeedItemDeleteBatch: line 34, column 14: DML operation DELETE not allowed on SPARTADMS__Corporate_Document__Feed

Any help would be appreciated.

Thanks, Chandan

  • Instead of the image, could you edit your post to include the stack trace? – battery.cord Jun 29 '16 at 19:40
  • how did you get the additional stack trace info? – Phil B May 8 '19 at 20:13
1

It is basically telling you that the user (Ghost user of LicenseManager Type) does not have permission to delete FEED records.

See this related question:

InstallHandler runs under a special ghost user. What rights does it have?

After trial and error investigation, it appears the InstallHandler can run with unlimited privileges given one special condition; the InstallHandler implementor must have without sharing annotation.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accountfeed.htm

You can delete all feed items you created. To delete feed items you didn’t create, you must have one of these permissions: - “Modify All Data” - “Modify All” on the Account object - “Moderate Chatter”

  • Updated the InstallHandler implementor and all other related controllers with "without sharing" annotation. Still facing the same problem. Even though users have "Modify All Data” and “Moderate Chatter” permission. – Chandan Jun 30 '16 at 7:54
0

here is the stack trace

Apex script unhandled exception by user/organization: 005xxxxxxxxx/00Dxxxxxxxx

Scheduled job 'FeedItem Delete Scheduled Job 40' threw unhandled exception.

caused by: line 3, column 44: Dependent class is invalid and needs recompilation: SPARTADMS.DMSFeedItemDeleteBatch: line 34, column 14: DML operation DELETE not allowed on SPARTADMS__Corporate_Document__Feed

  • Are you the same person as the OP? Not sure how they feel about multiple accounts here. – Eric Jun 30 '16 at 14:42
  • 2 persons can't work on the same issue...?? :) – Chandan Jul 27 '16 at 9:52

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.