Forum Discussion

PieInDaFace's avatar
PieInDaFace
Frequent Visitor
8 years ago
Solved

Disable Commenting on PowerBI Report Server

Wondering if there is a way to prevent commenting on a desktop report. Looking at the table dbo.upgradeinfo (within the reportserver - database), there is a item called "enablecomments" with a status...
  • PieInDaFace's avatar
    8 years ago

    Okay... so this is a dirty solution, but ended up putting in a trigger on the comments table of which desktop reports I dont want to allow commenting. Below is the *cough* "solution", which we also capture the comment and user name to have it send via email. If a user does attempt to submit a comment, they will receive the error message "An error has occurred. Something went wrong. Please try again later.". I believe the error is a result to not sending anything back from the post. Out of curiosity I imagine if you didn't want the error message, you could have the stored procedure "GetCommentByCommentID" return false data.


    declare @commentid int, @comment varchar(2048), username varchar(260

     

    if (select count(*) from dbo.[Catalog] a
    join inserted b on a.ItemID = b.ItemID
    where Name like '%your condition%') > 0


    begin


    select @commentid = a.commentid,@comment = a.[Text], username = coalesce(b.UserName,'Unknown') from inserted a
    left join dbo.Users b on a.UserID = b.UserID

    exec dbo.DeleteComment @commentid


    end