Validate Login Details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 11:16 PM
I have a one custom application that will contain a user registration form , login form , varieties of books with their description and price.
When I submit details from login page i need to validate user name and password of the registered users how can i write a code to validate? if its valid i will display the list of books otherwise give an alert like enter a valid username and password.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2022 10:44 PM
@jaheerhattiwale I tried the same with After Business with insert action as below but it's not redirecting to the list view of books details
(function executeRule(current, previous /*null when async*/) {
//var a=current.user_name;
//var b=current.password;
var gr = new GlideRecord('x_881103_book_cart_user_details');
gr.addQuery('email_id',current.user_name.toString());
gr.query();
while (gr.next()) {
if (gr.password.getDecryptedValue() == current.password.toString()) {
//gs.addInfoMessage('true');
gs.setRedirect("https://dev51184.service-now.com/now/nav/ui/classic/params/target/x_881103_book_cart_books_list.do%3...");
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2022 10:56 PM
@Soma Sekhar M Add a log in if block and check if we are getting the log or not
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2022 11:07 PM
@jaheerhattiwale as per ur guidelines i added a info log message in the business rule code as below
(function executeRule(current, previous /*null when async*/) {
//var a=current.user_name;
//var b=current.password;
var gr = new GlideRecord('x_881103_book_cart_user_details');
gr.addQuery('email_id',current.user_name.toString());
gr.query();
while (gr.next()) {
if (gr.password.getDecryptedValue() == current.password.toString()) {
//gs.addInfoMessage('true');
gs.info("navigate books list");
//gs.setRedirect("https://dev51184.service-now.com/now/nav/ui/classic/params/target/x_881103_book_cart_books_list.do%3...");
}
}
})(current, previous);
i checked with sys logs but i got message like as below
The selected record the result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2022 11:13 PM
@Soma Sekhar M Search for the text "navigate books list" in Message field of log table
ServiceNow Community Rising Star, Class of 2023