based on days i need to hide the catalog item

Gillerla Rajesh
Tera Contributor

Hi There,

 

if user can't login to servicenow in 30 days i need to hide the catalog item to the user and also i need to show alert message also like u don't have access like that,

 

how can i achive this.

 

 

Regards,

Rajesh.

4 REPLIES 4

Mark Manders
Mega Patron

Can you elaborate? If a user can't log in, he doesn't have access to any catalog item, right? 

And if you mean that if a user hasn't logged in for 30 days, you can't get this to work, because the user logs in, goes to the catalog item and he has logged in within the last 30 days.

 

Next to that: if you hide a catalog item, the catalog item just doesn't show up, so how do you want to show 'you don't have access to this' when 'this' isn't there for the user.

 

Can you update your question or reply with your exact requirements? Making a lot of assumptions on what it is you mean, runs a risk of not getting you your answer.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

@Mark Manders ,

 

yes need to restrict only user can't login 30 days then we can hide that catalog item.

 

is it possible to hide for particaular catalog item ?

or it's applicable to all catalog item.

 

Regards,

Rajesh.

 

Can you explain your exact requirements, because you repeated what you said before and it doesn't really make sense. If a user can't log in, he doesn't have access to any catalog item. If he logs in, he is logged in and that is within the last 30 days, so he has the catalog item available. Please elaborate on your question.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Najmuddin Mohd
Mega Sage

HI @Gillerla Rajesh ,
In the catalog item, you have Available for Related list.


Create a New one and write the script, which check the user is u_loggedIn(custom field which I will tell later) for last 30 days or not.

Now, why custom field. When the user logs In, the last login is updated making not easy to determine when the user last loggedIn. So, when the user logs in, update the logs in time with u_loggedIn time and compare with this field, instead of actual Logged In time.


Hope this helps.

Regards,
Najmuddin.