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

Is this line correct answer = null; ?



Shouldn't this be answer = ''; ?


I think it does not matter, but I tried. Still not working.



The gs.log should run regardless of the value in "answer".


Hi Peter,



While searching community for view and view rules, came across your question.


Hope you have figured it out




(function overrideView(<view name>, is_list) {


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


answer = <view name>;


})(<view name>, is_list);



Thanks


Tez




codycotulla
Tera Guru

Hi Peter,



I had the same issue with the view rule script not working as I expected.



I believe that the problem is with the glide.ui.remember_view property setting. If this value is set to true, then your view rule script will only run if the user does not have already have a view preference. If you set the value of the property to false, then your script will run each time.



I've attached an update set with a simple view rule and module for running it. The module opens the sc_req_item table with a view of ess.


The view rule, sets the view to default.


The updateset sets the glide.ui.remember_view property to false.



To test do the following.


  1. Install the update set.
  2. Go to the new RITM Test View Module.
    The view will be set to default.
  3. Try to change the view.
    You will not be able to change it.Note: That you will be able to see the different views, but when you try to switch views, the view will not change.
  4. Check the log for a message that starts with XXXXXX, You will find a message XXXXXXXXXXX ess
  5. Change the value of the glide.ui.remember_view sys_properties record to true.
  6. Repeat steps 2 and 3.
    You will be able to change the view.
  7. Check the log.
    There will not be a new log message that starts with XXXXX

Good luck, I hope this helps.



Thanks,



Cody


This is great ! Thank you, your solution helped me !!