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

2
  • Instead of the image, could you edit your post to include the stack trace? Commented Jun 29, 2016 at 19:40
  • how did you get the additional stack trace info?
    – Phil B
    Commented May 8, 2019 at 20:13

2 Answers 2

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”

1
  • 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
    Commented Jun 30, 2016 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

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

You must log in to answer this question.

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