Forum Discussion

rwm's avatar
rwm
Advisor
10 years ago

settings.name.get confusion

This is more an FYI post than an issue.   Many posts talk about using settings.name.get to fetch a value, and I was using it to get the same value in two components.   One component on my home/category page worked great, but the same component failed on forum topic pages (null or missing value error).   My thought was a scoping issue, but what threw me off is the second component that used the same call worked at both forum and forum topic pages no problem.  Put another way, on my forum topic pages I had two components, both using settings.name.get to fetch the same value, but one worked and one failed.  Huh?  Many posts say it gets a 'user' setting (such as profile.language), but if so then I would have expected failure in all my cases.  My setting has community/category/board scopes, but only the community level setting has data.

 

I eventually fixed my problem by using "community.settings.name.get".  I still do not know why one component worked and one failed but using settings.name.get alone is questionable to me, and the docs use different terms and are not totally clear.  What is clear from all the posts I read is that other people have also experienced confusion with this.   This article says that it's a community setting, but if so then why did one fail?

 

So I would offer a suggestion for anybody using this (particulary across different scopes/pages) that you may want to consider a more explicit reference such as:

 

community.settings.name.get 

coreNode.settings.name.get

(not sure if there are others?)

 

Of course, you can avoid this and use a REST API call with the specific path to the setting instead.

 

No RepliesBe the first to reply