Developer forum

Forum » Development » Error Comment.GetComments module

Error Comment.GetComments module

Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Hi

i am getting errors on Comments.GetComments Module. Did I miss anything, I am trying to bring these comments to the mobile app using API. product comments added from backend using real customer email address

 

 

 


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Shiwanka,

I'm not quite sure how you're getting the comments. It seems that you're executing in a context without a user, however, if you use the method Comment.GetComments, you shouldn't need a user.

You mention both a module and an API method, so could you elaborate on your setup?

- Jeppe

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Hi Jeppe

i am trying to read all comments to the product and send it to the mobile app through web api

but I doubt why these Comment.GetComments need user context? according to the error

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

The issue occurs because the constructor for Comment tries to find the current user. It does this preemptively to have the value available when saving. This is unnecessary and I've created a task to get the logic changed, #4016.

In the meantime, as a workaround, you can create an index that stores the comments by using the SQL Index Builder. Then you can use either the QueryPublisher or the API to fetch the data. This approach also gives you the option to search/query the comments which may come in handy. Alternatively, you can access the database directly to fetch the data -- only use this as a temporary workaround as it's not a recommended solution long-term.

- Jeppe

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Thanks Jeppe

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Shiwanka

The change on #4016 regarding Comments in user context has now been implemented in Dynamicweb version 9.10.13

You can get this from the download section https://doc.dynamicweb.com/downloads/releases

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum