View rule script is working only on "default" view

peter_repan
Tera Guru

Hi all,

we implemented View rule with script (we are running Helsinki) for sc_req_item table.

But we realized, the view rule is working only on "default" view. So in case sc_req_item table is using view "mobile", the View rule does not apply.

It does not make sense for me. Is it a bug or "feature". Why is scripted View rule working only on "default" views? This is totally unuseful...

Or did we miss something? There is almost nothing in official documentation about View rule script.

9 REPLIES 9

Kalaiarasan Pus
Giga Sage

Not a great question but is the advanced checkbox selected for the view rule that you are facing the issue?


yes of course, otherwise I'm not able to write the script


I haven't used much view rule scripting before but can you share the script that you are using? I/someone can help you better if the script is posted.



Also, is the view to be used set to 'answer' variable in the script? Is 'Overrides user preference' true?


The script is pretty. Simple. I'm trying to insert a log to see if the script is evaluated:



(function overrideView(view, is_list) {



      gs.log('PETER TEST', 'Peter');


     


      // Add your code here


      answer = null;   // set the new view to answer



})(view, is_list);



and yes, 'Overrides user preference' is set to true