Error on core_v2_abuseReport.Create

We are trying to create an automation to flag content as abusive with some additional checks. We are getting the following error:

We are using this code:

var thread = core_v2_forumThread.Get(563075);
return core_v2_abuseReport.Create(thread.ContentId, core_v2_forumReply.ContentTypeId, {});



Fixed typo
[edited by: Stephen Vicino at 9:56 PM (GMT 0) on Tue, Nov 15 2022]
Parents
  • Use core_v2_forumThread.ContentTypeId instead of ForumReply.  The actual exception is being hidden due to a secondary exception when the Sandbox attempts to display a Report object that was created due to an exception.  Try the following, it should display the actual exception when one occurs instead of attempting to display the whole Report object.

    var thread = core_v2_forumThread.Get(13);
    var report = core_v2_abuseReport.Create(thread.ContentId, core_v2_forumThread.ContentTypeId, {});
    
    if (report.Errors.Count > 0) { return report.Errors; } else { return report; }

Reply
  • Use core_v2_forumThread.ContentTypeId instead of ForumReply.  The actual exception is being hidden due to a secondary exception when the Sandbox attempts to display a Report object that was created due to an exception.  Try the following, it should display the actual exception when one occurs instead of attempting to display the whole Report object.

    var thread = core_v2_forumThread.Get(13);
    var report = core_v2_abuseReport.Create(thread.ContentId, core_v2_forumThread.ContentTypeId, {});
    
    if (report.Errors.Count > 0) { return report.Errors; } else { return report; }

Children