<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lior on Medium]]></title>
        <description><![CDATA[Stories by Lior on Medium]]></description>
        <link>https://medium.com/@lior849?source=rss-1012b1408af6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OTic4CPilWhafP_I</url>
            <title>Stories by Lior on Medium</title>
            <link>https://medium.com/@lior849?source=rss-1012b1408af6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:08:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lior849/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Automating Modern Web Development on the Now Platform: A Journey with ServiceNow and React on a…]]></title>
            <link>https://medium.com/@lior849/automating-modern-web-development-on-the-now-platform-a-journey-with-servicenow-and-react-on-a-6612d796b7c8?source=rss-1012b1408af6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6612d796b7c8</guid>
            <category><![CDATA[jelly]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[servicenow]]></category>
            <dc:creator><![CDATA[Lior]]></dc:creator>
            <pubDate>Thu, 22 Aug 2024 13:29:26 GMT</pubDate>
            <atom:updated>2024-08-23T11:29:54.880Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automating Modern Web Development on the Now Platform: A Journey with ServiceNow and React on a Private Cloud</h3><p>In today’s rapidly evolving tech landscape, keeping your applications modern and efficient is essential.</p><p>Our team which is part of a private air-gapped cloud vendor that utilizes ServiceNow to administrate managed services — faced a similar challenge when we set out to upgrade our ServiceNow environment.</p><p>The existing NOW Service Portal built on AngularJS, was outdated and slow, creating significant bottlenecks in both development speed and user experience. This article details our journey as we transitioned to a React-based application within the ServiceNow platform, including the challenges we encountered and the solutions we implemented.</p><h4>The Problem</h4><p>Our Service Portal was plagued with issues:</p><ul><li><strong>Outdated Design:</strong> The AngularJS-based portal had an outdated look and feel, failing to meet modern design standards.</li><li><strong>Slow Development:</strong> The heavy reliance on Out-of-the-Box (OOTB) scripts made development sluggish, with small changes requiring extensive time due to the complexity and redundancy of these scripts.</li><li><strong>Inconsistent Knowledge Management:</strong> The flexibility of the knowledge editor led to a lack of uniformity in the appearance of articles, which was not ideal for a consistent user experience.</li></ul><p>Given these challenges, we knew a complete overhaul was necessary. Our solution? Integrating a React application into the ServiceNow environment.</p><h4>Our Solution: React Integration</h4><p>We chose React (over Svelte/Angular/NOW Studio XML source control) for its simplicity, performance, and ease of use. By creating a Single Page Application (SPA) with React, we could drastically reduce the complexity caused by OOTB scripts and improve overall performance.</p><p><strong>Why React?</strong> React’s SPA nature allowed us to eliminate unnecessary overhead and improve latency. Moreover, React’s component-based architecture made the development process faster and more modular.</p><h4>Development Journey</h4><ol><li><strong>Proof of Concept (POC):</strong><br>The first step was to validate our approach. We created a Proof of Concept by minifying the necessary JavaScript and CSS files (referenced through JS Includes and CSS Style sheet objects in ServiceNow) of a basic React application. These files were then uploaded to the Now Studio tool and referenced in an index.html file under a ServiceNow UI page. The POC was successful, proving that we could host a React app within ServiceNow and paving the way for further development.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*RWuAtRSSEpWJCYNUx67L3Q.png" /><figcaption>ServiceNow Studio Build-Tree</figcaption></figure><p><strong>2. Cloud Development:</strong><br>To expedite the initial development, we set up a Git repository for our React application and hosted it on our Azure instance. This allowed us to leverage the full range of NPM packages without the restrictions of an on-premise environment. The steps included:</p><ul><li><strong>Creating the Git Repository:</strong> This provided version control and collaboration for our development team.</li><li><strong>Setting Up the Azure Instance:</strong> We deployed a scoped app on Now Studio to store the minified files and established REST API connections to access Azure instance data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*0WxVVpznNag2K4aLep5ZFw.png" /><figcaption>Day 1 main page using the ServiceNow knowledge-base API</figcaption></figure><p><strong>3. On-Premise Transition:</strong><br>Once cloud development was complete, we transitioned the application to our on-premise environment. This phase was particularly challenging due to the limitations of the on-premise network. Key adjustments included:</p><ul><li><strong>Handling External Libraries:</strong> We needed to refactor or replace any libraries that relied on internet access, opting for on-premise alternatives where available.</li><li><strong>Refactoring REST API Calls:</strong> To ensure the application could communicate with our on-premise ServiceNow instances, we modified the REST API calls accordingly.</li><li><strong>Creating On-Premise Git Repository:</strong> We established separate Git repository for the on-premise version of the application to manage any necessary patches distinct from the cloud version (and there were many).</li><li><strong>ServiceNow configuration:</strong> To allow accessibility we created ServiceNow CORS Policy Rules, modules &amp; applications (application object, not frontend application) which link to our UI Page.</li></ul><h4><strong>Implementing CI/CD</strong></h4><p>Setting up a Continuous Integration/Continuous Deployment (CI/CD) pipeline was critical for managing the deployment process efficiently, without a smart pipeline, we could not rely on this application in production since we were used to update sets and ServiceNow’s source control mechanism. Our CI/CD pipeline was designed to:</p><ul><li><strong>Manage Environment Variables:</strong> We defined environment variables to ensure seamless integration with third-party services, such as S3,ServiceNow API and NGINX.</li><li><strong>Handle Build Files:</strong> The pipeline selected the appropriate NPM build files (JavaScript/CSS) and updated system properties which referenced the JS Includes/StyleSheets within the index.html.</li><li><strong>Deploy Across Environments:</strong> The CI/CD pipeline automated the deployment process across development, testing, and production environments.</li></ul><h4>Overcoming Challenges &amp; Fears</h4><p>Throughout the project, we faced numerous challenges, each of which required creative problem-solving from our side:</p><ul><li><strong>High Application Latency:</strong> By leveraging React’s SPA architecture, we minimized the load caused by unnecessary scripts, significantly improving latency.</li><li><strong>Maintaining functionality of ServiceNow Service Catalog and Virtual Agent (and any other object): </strong>Huge objects such as the Service Catalog and Virtual Agent rely on many Client Scripts/UI Policies/Variable Sets/Flow designer logic and many other features which are OOTB in ServiceNow and cannot be developed in-house in such a short period of time. The solution we thought of is implementing these components as iframes in the react application but modifying their CSS style behavior through their UI Pages/Branding editor/UI Builder to match the React application’s style (configuring system properties such as X-Frame-Options was necessary).</li><li><strong>Maintaining ServiceNow’s libraries functionality:</strong> Another fear we had when committing to this project is losing the functionality of ServiceNow built in functions such as <strong>g_user</strong>.hasRole(‘itil’) and many more functions we wouldn’t want to request through API (inefficient and causes high latency). By creating our UI Page, we realized using jelly scripts in the index.html alongside the injected JS/CSS scripts allows us to reference variables such as &#39;${window.isItil}&#39; which is passed through a g2 tag — &lt;g2:evaluate var=&quot;isItil&quot; jelly=&quot;true&quot;&gt;<br> var return_value = g_user.isItil()<br> return_value ;<br>&lt;/g2:evaluate&gt;</li><li><strong>REST API Limitations:</strong> When the default ServiceNow REST APIs didn’t meet our needs, we developed custom Scripted REST APIs.</li><li><strong>Knowledge uniformity: </strong>Facing the problem of the old knowledge editor formatting freedom, we created a parser using libraries such as rehype-dom-parse hast/hast-util unified to maintain headings’ rank, size and ToC relation. Additionally we used prismjs and imported all the relevant programming languages to keep the code-blocks’ appearance (found it in ServiceNow source code).</li><li><strong>On-Premise Package Management:</strong> The restrictions of our on-premise network made it difficult to use certain NPM packages. We addressed this by using existing on-premise packages or older versions that were compatible with our environment.</li><li><strong>UI Navigation:</strong> To ensure a smooth transition between the old and new UIs, we implemented an API Gateway using NGINX to handle redirection between the new React Application and the old Service Portal, which also allowed us to refactor our application overtime.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*OIR1S_Ev-6j2YdeKjSAlzQ.png" /></figure><h4>Looking Ahead</h4><p>Our experience integrating React with ServiceNow was a learning process filled with challenges and triumphs. By modernizing our platform, we not only improved the performance and user experience but also laid the groundwork for future enhancements.</p><p>We achieved modern development through git using CICD, while being able to customize our needs through NOW Scripted Rest APIs and iframes developed through update sets — Each development task might refer an update set alongside git merge request.</p><p><strong>Special thanks to Andrew Phischulin for his insightful articles that guided us throughout the beginning of this process - </strong><a href="https://pishchulin.medium.com/react-in-servicenow-applications-advanced-3e1966fbb817">https://pishchulin.medium.com/react-in-servicenow-applications-advanced-3e1966fbb817</a></p><h3>Conclusion</h3><p>Modernizing legacy tools like ServiceNow Service Portal can be daunting, but with the right tools and approach, it is entirely achievable in a rather short period (5 weeks).</p><p>Our transition to a React-based service portal has proven to be a success, offering faster development times, better performance, and a more modern user experience. This project stands as a testament to the power of modern web development practices within traditionally rigid platforms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6612d796b7c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>