File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed
Modern Development/Service Portal Widgets/custom404 Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ < div >
2+ < h1 class = "heading-message" > ${ This page could not be found . Based on your search we have found below valid pages } </ h1 >
3+ < div class = "page-container" > <!-- Container to show valid pages.-->
4+ < ul >
5+ < li ng-repeat = "item in data.pageArr" > <!-- List to show valid pages.-->
6+ < a href = { { item . url} } target = "_blank" > { { item . name} } </ a >
7+ </ li >
8+ </ ul >
9+ </ div >
10+ </ div >
Original file line number Diff line number Diff line change 1+ ** How to use**
2+ 1 . Add this widget to new portal page.
3+ 2 . Add the page in "sp_portal" record in 404 field.
4+
5+ ** Use Case**
6+ 1 . Some organizations do not want to show OOB 404 page having game but want to show the suggestions with correct pages.
7+
8+ ** Result**
9+ 1 . This code will search the 3 letters of page_id from URL and will suggest correct pages.
10+ 2 . The correct links will open the pages in next tab.
11+
12+ <img width =" 959 " height =" 413 " alt =" 404 " src =" https://github.com/user-attachments/assets/2480ba26-4ea3-4e12-baf8-bbf89fec548a " />
13+
14+
15+
Original file line number Diff line number Diff line change 1+ . heading - message {
2+ color:red ;
3+ }
4+ . page - container {
5+ display: flex ;
6+ justify - content : space - evenly ;
7+ flex - direction :cloumn ;
8+ }
9+ ul {
10+ padding: 2 rem ;
11+ list - style - type : disclosure - closed ;
12+ }
13+ li {
14+ padding:1 rem ;
15+ }
Original file line number Diff line number Diff line change 1+ ( function ( ) {
2+ /*
3+ This script will get the 3 characters of page_id from url and suggest valid pages.
4+ */
5+ data . pageArr = [ ] ; // array to store related pages
6+ var pageId = $sp . getParameter ( 'id' ) . toString ( ) ; // get page id from url
7+ // get 3 letters of page id
8+ if ( pageId && pageId . length ( ) > 3 )
9+ pageId = pageId . substring ( 0 , 3 ) ;
10+
11+ var relatedPages = new GlideRecord ( 'sp_page' ) ;
12+ relatedPages . addEncodedQuery ( 'idLIKE' + pageId ) ;
13+ relatedPages . query ( ) ;
14+ while ( relatedPages . next ( ) ) {
15+ var tempList = { } ; // temporary object.
16+ tempList . name = relatedPages . getValue ( 'title' ) ;
17+ tempList . url = '/' + $sp . getValue ( 'url_suffix' ) + '?id=' + relatedPages . getValue ( 'id' ) ;
18+ data . pageArr . push ( tempList ) ; // add related suggested pages to array
19+ }
20+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments