I am writing a JavaScript code where I want to allow user to provide star ratings to a particular article. This code will be in the form of widget. SO I want to first check if the Rating is enabled for a given sharepoint list. So, if the Rating is enabled then execute Rating related code.
I know we can do this by checking if Rating, AverageRating columns are present in a list. However I don't want to go that way because there might be a possibility where user has created those columns manually and Rating setting is disabled.
Can anyone provide a sample JS code for this?
As far as I know, you can only determine whether the rating function is enabled by checking whether the related column is rated again.
Three columns will be automatically created after the Rating function is turned on.
You can check that these three columns are all co-existing to avoid the impact of users creating columns with the same name. After the rating is turned on, the column with the same name will also be converted into a rating column.
Default internal name of rating column: I create a separate column with the same name.
Then I turn on Rating.