how set default homepage for select users depends upon rules

rakhi1234
Kilo Contributor

i have created one homepage i want to set as a default for   user has speccific role...can i use fix script..kindly suppest me

8 REPLIES 8

DrewW
Mega Sage
Mega Sage

A users current home page is a user preference if memory serves so you can just run a script to add/update the preference to the users who have the role.   You should probably set the read role for the home page also if you do not want others to see it.


Patrick Schult2
Giga Guru

You can use a Fix Script for this purpose as long as you are not wanting it to proactively change users homepages on the fly. The Fix Script runs at a point in time.



Hompages are set per-user using a User Preference. If you want to change them, you would have a Fix Script run a GlideRecord on the sys_user_preference and use a query like "User preferences called homepage, for users that have role itil". It looks like the screenshot I included. You would then tell the GlideRecord to update each record in the result to the sys_id of whatever homepage you want to set these users to. I included an untested sample script as an example of one way you could do this.


user_prefs.png


var prefs = new GlideRecord('sys_user_preference');


prefs.addQuery('name', 'homepage').addCondition('user.roles', 'admin');


prefs.query();


prefs.setValue('name', sys_id_of_new_homepage_here); //put your new homepage's sys_id here


prefs.updateMultiple();


hi pratrick,



i am little bit confusion shall i write script in fixscript or user preference table


var prefs = new GlideRecord('sys_user_preference');


prefs.addQuery("name","IncidentReports").addCondition('user.roles', 'rk');


prefs.query();  


prefs.setValue('name',"d99e496cdbcdb200f257ddd0cf961966"); //put your new homepage's sys_id here  


prefs.updateMultiple();