<?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 Sushmitha Bhat on Medium]]></title>
        <description><![CDATA[Stories by Sushmitha Bhat on Medium]]></description>
        <link>https://medium.com/@sushmithabhat95?source=rss-5614ab86ec17------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*JaC8fQ4lNjhLunhh</url>
            <title>Stories by Sushmitha Bhat on Medium</title>
            <link>https://medium.com/@sushmithabhat95?source=rss-5614ab86ec17------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:03:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sushmithabhat95/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[UI Builder Dynamic Data Binding]]></title>
            <link>https://sushmithabhat95.medium.com/ui-builder-dynamic-data-binding-a19eea4d60dc?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/a19eea4d60dc</guid>
            <category><![CDATA[servicenow]]></category>
            <category><![CDATA[dynamic-data]]></category>
            <category><![CDATA[uib]]></category>
            <category><![CDATA[servicenow-integration]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Thu, 16 May 2024 01:25:34 GMT</pubDate>
            <atom:updated>2024-05-16T01:27:13.907Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>When working with dynamic data binding in UI Builder, understanding how to access various elements is crucial for seamless integration and functionality.</strong></p><h4><strong>Table of Contents on Data Binding :</strong></h4><ol><li>Introduction</li><li>Properties</li><li>Data Resource</li><li>Client State Parameter</li><li>Event Action</li><li>Conclusion</li></ol><h3><strong>Introduction</strong></h3><p>If we are passing a <strong>Static Data</strong> : we use pencil icon to enter static Value.<br>Example below: “Let’s workflow it” is static data assigned for a text</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*FuJGIlhsSlmA3nCiVxzEGw.png" /><figcaption>Source: ServiceNow Documentation, the pencil icon here is for entering static value</figcaption></figure><p>If we are passing a <strong>Dynamic Data</strong> : we use database icon to enter dynamic Value. Refer the example below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*OAQhSKQGPbDrn1oCxsDYCA.png" /><figcaption>Source: ServiceNow Documentation, the database icon here is for entering dynamic value</figcaption></figure><h3>Properties (@context.propName):</h3><ul><li><strong>Definition:</strong> Props provide data passed from a parent component to a child component.</li><li><strong>What we get:</strong> The value of a prop can be either a required or optional parameter, defining how the child component interacts with its parent.</li></ul><p><strong>Why do we need ..?</strong></p><ul><li>When building complex UI components, you often need to pass data from a parent component to a child component.</li><li>Props allow you to achieve this by passing data down the component hierarchy.</li><li>This is useful for creating reusable and modular components, as each component can be configured differently based on the props it receives.</li><li><strong>Example</strong>: If you have a product component, you might pass the product details (like name, price, etc.) as props from a parent component.</li></ul><h3>Data Resource (@data.lookup_resource.dataName):</h3><ul><li><strong>Definition:</strong> Data resources fetch and manage external data within UI components.</li><li><strong>What we get:</strong> By creating a data resource, we obtain access to the data specified by the resource name (dataName), enabling seamless integration of external data into our UI.</li></ul><p><strong>Why do we need ..?</strong></p><ul><li>Web applications often need to fetch and display data from external sources, such as databases or APIs.</li><li>Data resources in UI Builder provide a way to fetch and manage this external data within your UI components.</li><li>This allows you to keep your UI components decoupled from data-fetching logic, improving maintainability and scalability.</li><li><strong>Example</strong>: You might use a data resource to fetch a list of products from a backend server and display them in a product list component.</li></ul><h3>Client State Parameter (@state.stateName):</h3><ul><li><strong>Definition:</strong> Client state parameters store and manage client-side state within UI components.</li><li><strong>What we get: </strong>Creating a new state provides us with a state variable (stateName) that can be dynamically updated and accessed within the component, facilitating the management of UI state without relying on server-side storage.</li></ul><p><strong>Why do we need ..?</strong></p><ul><li>Sometimes, you need to maintain state within your UI components that doesn’t need to be persisted on the server.</li><li>Client state parameters in UI Builder provide a way to store and manage this client-side state.</li><li>This is useful for things like managing form input values, controlling UI visibility, or caching data for better performance.</li><li><strong>Example</strong>: You might use a client state parameter to store the current page number in a paginated list component.</li></ul><h3>Event Action Data (@payload.eventName):</h3><ul><li><strong>Definition:</strong> Event action data is the data associated with events triggered by user interactions.</li><li><strong>What we get:</strong> After an event occurs, accessing @payload.eventName allows us to retrieve any relevant data associated with that specific event, enabling dynamic responses to user actions within our UI components.</li></ul><p><strong>Why do we need ..?</strong></p><ul><li>User interactions, such as button clicks or form submissions, often trigger events in your UI components.</li><li>Event action data, accessed through the payload, provides a way to access any data associated with these events.</li><li>This allows you to respond dynamically to user actions and update your UI accordingly.</li><li><strong>Example</strong>: When a user clicks a “Submit” button on a form, you might access the form data from the payload to validate and process it.</li></ul><p>Below is a cheat sheet to help you navigate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*77vFIWxfMw4hM5kcc39d7A.png" /></figure><h3><strong>Conclusion</strong></h3><p>This breakdown clarifies what each element provides in terms of functionality and how they contribute to building dynamic and interactive user interfaces.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a19eea4d60dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic Web Development In UI Builder ServiceNow]]></title>
            <link>https://sushmithabhat95.medium.com/dynamic-web-development-in-ui-builder-servicenow-56bf0574af66?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/56bf0574af66</guid>
            <category><![CDATA[uib]]></category>
            <category><![CDATA[servicenow]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Wed, 15 May 2024 14:10:48 GMT</pubDate>
            <atom:updated>2024-05-15T14:12:11.561Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unlocking the Power of Client State Parameters, Client Scripts, and Page Events.</h3><h4><strong>Table of Contents</strong></h4><ol><li>Introduction</li><li>Client State Parameter</li><li>Client Scripts</li><li>Page Events</li><li>Conclusion</li></ol><h3><strong>Introduction:</strong></h3><p>In the domain of web development, understanding how data flows between different components and pages is crucial. One of the fundamental concept is the client state parameter. In this article, we’ll break down what the client state parameter is, how it relates to client scripts, and its role in handling page events. By the end, you’ll have a clear understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*v0O_bTPMzH4LD-I35pUTDQ.png" /><figcaption>Source : ServiceNow Documentation, example for Dynamic Web Development</figcaption></figure><h3><strong>Client State Parameter:</strong></h3><p>The client state parameter refers to the data stored on the client-side, typically within the browser, that maintains the state of a web application. This data can include user preferences, session information, or any other relevant information needed for the application to function.<br> Here’s why it’s needed:</p><ul><li><strong>Persistent Data:</strong> It allows you to store information that persists across different pages or interactions within a website. For example, in an e-commerce site, it keeps track of items in the shopping cart or user preferences.</li><li><strong>Responsive User Experience:</strong> By storing data on the client-side, the application can respond quickly to user actions without needing to constantly communicate with the server. This leads to a smoother and more responsive user experience.</li><li><strong>Reduced Server Load:</strong> Since not all data needs to be fetched from the server every time, using client-side state management can reduce the load on the server, making the application more efficient.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*sDIf-3yiouDARN6i1h6jxw.png" /><figcaption>Source: ServiceNow Documentation, explains on creating Client State Parameter and display the preview</figcaption></figure><h3><strong>Client Scripts:</strong></h3><p>Client scripts are snippets of code executed on the client-side (in the user’s browser). These scripts can manipulate the client state parameter, update the UI, or interact with the server to fetch or send data. <br>Here’s why they’re necessary:</p><ul><li><strong>Dynamic Updates:</strong> Client scripts enable dynamic updates to the user interface without requiring a page refresh. For example, in a form validation scenario, client scripts can instantly provide feedback to users without waiting for server-side validation.</li><li><strong>Real-time Interaction:</strong> They facilitate real-time interaction with the user, allowing for immediate responses to user actions. This creates a more engaging and interactive user experience, such as in live chat applications or online games.</li><li><strong>Reduced Server Requests:</strong> By handling tasks on the client-side, such as form validation or data manipulation, client scripts can reduce the number of requests sent to the server, improving performance and scalability.</li></ul><p><strong>You can use scripts to do the following:</strong></p><ul><li>Get available data, manipulate the data, and store it in the client state.</li><li>Access data resource results.</li><li>Execute data resource operations.</li><li>Dispatch events.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*UE45Pc_18avGCr09UN2MrA.png" /><figcaption>Source: ServiceNow Documentation, shows how to create a Client Script</figcaption></figure><h3><strong>Page Events:</strong></h3><p>Page events are actions or interactions that occur within a web page, triggering client scripts to respond accordingly. These events can include user input, page load, mouse movements, or any other action that prompts a response from the client-side code.<br>Here’s why they’re important:</p><ul><li><strong>User Feedback:</strong> Page events provide feedback to users when they interact with elements on the page. For example, clicking a button triggers a page event, indicating that the action has been recognized and processed.</li><li><strong>Event Handling: </strong>They enable developers to write code that responds to specific user actions, such as form submissions or mouse clicks. This allows for the implementation of interactive features and functionalities tailored to user behavior.</li><li><strong>State Management:</strong> Page events are often used in conjunction with client state parameters to manage the state of the application. For example, when a user adds an item to their shopping cart, a page event can update the client state parameter to reflect the change in state.</li></ul><p><strong>There are three basic types of events:</strong></p><ul><li><strong>Component events</strong> — most components have a set of events they will fire based on some sort of interaction with the component. An example could be a list loading or button clicked. Events and payloads are the way that components can interact with other components on your page.</li><li><strong>Data resources</strong> — data resources generally have events that notify you about the progress of the data fetch, like when the data is returned to the page.</li><li><strong>Page events</strong> — Pages have default events like when the page is loaded, and you can also create handled events on the page that can be called from other places.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*OqTyzP_MkbzE0UUL_S0cqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*OUodjm8TrK8-ucGELpHYWg.png" /><figcaption>Source : ServiceNow Documentation &amp; both the picture above are not related only for reference</figcaption></figure><h3><strong>Conclusion:</strong></h3><p>Understanding the client state parameter is essential for building dynamic and interactive web applications. By leveraging client scripts and responding to page events, developers can create seamless user experiences that respond to user actions in real-time.</p><p>Follow the link for deeper understanding : <br>Source : <a href="https://developer.servicenow.com/print_page.do?release=washingtondc&amp;category=course-module&amp;identifier=app_store_learnv2_uibuilder_washingtondc_client_side_interactions_in_ui_builder,UCS_UsingHandledEvents_washingtondc&amp;module=course">https://developer.servicenow.com/print_page.do?release=washingtondc&amp;category=course-module&amp;identifier=app_store_learnv2_uibuilder_washingtondc_client_side_interactions_in_ui_builder,UCS_UsingHandledEvents_washingtondc&amp;module=course</a></p><p>Source : <a href="https://developer.servicenow.com/blog.do?p=%2Fpost%2Fquebec-ui-builder-client-state-scripts-events%2F">https://developer.servicenow.com/blog.do?p=%2Fpost%2Fquebec-ui-builder-client-state-scripts-events%2F</a></p><p>Note : Images are from ServiceNow documentation, which are for reference to understand the concept.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56bf0574af66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Join the UI Builder Adventure: A Beginner’s Guide to ServiceNow’s Interface]]></title>
            <link>https://sushmithabhat95.medium.com/join-the-ui-builder-adventure-a-beginners-guide-to-servicenow-s-interface-94c5291b65f8?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/94c5291b65f8</guid>
            <category><![CDATA[uib]]></category>
            <category><![CDATA[servicenow-training]]></category>
            <category><![CDATA[servicenow-data-sync]]></category>
            <category><![CDATA[servicenow-integration]]></category>
            <category><![CDATA[servicenow]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Wed, 08 May 2024 16:36:52 GMT</pubDate>
            <atom:updated>2024-05-14T02:45:25.888Z</atom:updated>
            <content:encoded><![CDATA[<p>ServiceNow’s UI Builder empowers users to create modern and intuitive interfaces without extensive coding knowledge. Through its modular approach, UI Builder streamlines the process of designing and customizing UI elements, enhancing user experience across ServiceNow applications.</p><p>This article provides a comprehensive guide to key components and functionalities within UI Builder.</p><h3><strong>Table of Contents:</strong></h3><ol><li>Page Parameters</li><li>Page Template</li><li>Page Variants</li><li>Data Resources</li><li>Conclusion</li></ol><p><strong>Lets Get Started, First lets talk about the basic:</strong><br>If you are too new on UI Builder and want to learn from Scratch here is the ServiceNow Documentation with detailed steps, I have attached the link below. Just choose suitable version [Washington DC, Vancouver, Utah]. I&#39;m using <strong>Utah </strong>for the example reference.</p><p><a href="https://developer.servicenow.com/dev.do#!/learn/courses/utah/app_store_learnv2_uibuilder_utah_ui_builder/app_store_learnv2_uibuilder_utah_create_pages_in_ui_builder/UCP_CreatingAPage_Utah"><strong>https://developer.servicenow.com/dev.do#!/learn/courses/washingtondc/app_store_learnv2_uibuilder_washingtondc_ui_builder/app_store_learnv2_uibuilder_washingtondc_create_pages_in_ui_builder/UCP_Objectives_CreatePages_washingtondc</strong></a></p><p>Just have a look on UI Builder Page attached below, If you are comfortable with this page lets proceed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*y_BO_yXwvr13TPd8F00mWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*4dKeoqd9ESrekPpaoMu2WQ.png" /><figcaption>Source : ServiceNow Documentation</figcaption></figure><h3><strong>1. Page Parameters:</strong></h3><p>Page Parameters in UI Builder allow for dynamic customization of page content based on user inputs or system variables.</p><p>It has 2 Types :<br><strong>1) Required Parameters: Must be given a value to load the page</strong><br><strong>2) Optional Parameters: Not necessary to load the page</strong></p><ul><li>Props are custom attributes that can be passed to a component when it’s used within a UIB page or another component.</li><li>For hardcoded simple text just use the pencil icon, for dynamic data bind the data with @context.props</li><li>@context.props contains all the props passed to the component.<br>For example, if you have a prop named color, you can access it using @context.props.color.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YKNbWJiL8j79FfYaVUwQ3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yf6OdEVwYBYv8BEcB8pZ9Q.png" /><figcaption>Reference left picture on how to<strong> bind data</strong> @context.props and Right screen shot is output <strong>page URL</strong> : output of @context.props.color</figcaption></figure><ul><li>For example, if you have a UIB component called MyComponent and you use it within a page like this:</li></ul><pre>// Inside MyComponent, you would access color and size using <br>// @context.props.color and @context.props.shape, respectively.<br>&lt;MyComponent color=&quot;Blue&quot; shape=&quot;Square&quot; /&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*mIrOGw9QNkFUK7-thhclOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*93L1aVhfzENfZ0nrjZ78pA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9-BGETHSnR3se2_SSx0XQw.png" /><figcaption>Reference on how to <strong>attach parameters</strong> to a page and <strong>assign value</strong> and <strong>data </strong>to the parameter</figcaption></figure><p>Lets talk about their URL :</p><ul><li>I have given value for <strong>color </strong>parameter as <strong>Blue </strong>and <strong>shape </strong>as <strong>Square</strong></li><li>URL :https://dev220523.servicenow.com/x/1331190/handson/home/<strong>Blue</strong>/params/shape/<strong>Square</strong></li><li>Required Parameter just add <strong>Blue </strong>to path parameter</li><li>Optional Parameter add <strong>params/shape/Square</strong> to path parameter</li></ul><p>For a detailed explanation on this watch ServiceNow’s video :<br><a href="https://www.youtube.com/watch?v=4UxdWqlAuqw&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=2"><strong>https://www.youtube.com/watch?v=4UxdWqlAuqw&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=2</strong></a></p><h3><strong>2. Page Template :</strong></h3><p>We need <strong>page templates</strong> to ensure consistency and efficiency in designing ServiceNow interfaces. They provide a framework for organizing elements like headers, footers, and navigation menus.</p><p>There are 2 ways to create a template for Legacy Template:</p><ul><li>“<strong>Use the original page (customization limited)</strong>”links the page to the template, ensuring that any updates made to the template reflect automatically on the linked pages.</li><li>“<strong>Copy contents of the page (fully customizable)</strong>” duplicates the template content onto the page but does not establish a link. This means changes made to the original template won’t affect the copied content, requiring manual updates if changes are needed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7LvUHy0nIKqHWeKq5vtU_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KSvzJrBo-3KSuNWKjkY0Cw.png" /><figcaption>Reference for page template</figcaption></figure><p>For a detailed explanation on this watch ServiceNow’s video :<br><a href="https://www.youtube.com/watch?v=tsH0-pR1elo&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=3"><strong>https://www.youtube.com/watch?v=tsH0-pR1elo&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=3</strong></a></p><h3><strong>3.Page Variant:</strong></h3><p>Page variants are useful for:</p><ol><li><strong>A/B Testing</strong>: Developers can create different variants of a page to test variations in design, layout, or content to determine which version performs better in terms of user engagement, conversion rates, etc.</li><li><strong>Personalization</strong>: Page variants can be tailored to specific user segments or personas, providing a personalized experience based on factors such as user roles, preferences, or behaviors.</li><li><strong>Localization</strong>: Variants can be created to accommodate different languages, cultural preferences, or regional requirements, ensuring that the user interface remains relevant and accessible across diverse audiences.</li><li><strong>Feature Rollouts:</strong> Developers can use variants to gradually roll out new features or changes to a page, allowing for controlled testing and validation before deploying the changes to all users.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*oLrdTZIWk4Djeir2PssCWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPZ-Q8-nbQ4mwNgmQ3E4OQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*P5NA_l6K9BYG9uU9VTW61g.png" /><figcaption>Reference on how to create a variant with condition for variant page</figcaption></figure><ol><li>For Home Default Text component, Title data I have binded @context.props.color</li><li>For Variant page I have hard coded Text component, Title as “Color is not Blue”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUhEtI7b-Xo6kdaWtyHz7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yf6OdEVwYBYv8BEcB8pZ9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ByerAcw4q5moQiQuSXHeQ.png" /><figcaption>Reference on Home Default page condition, and output for both variant</figcaption></figure><ul><li><strong>URL </strong>: https://dev220523.service-now.com/x/1331190/handson/home/<strong>Blue</strong>/params/shape/Square<br>output : From Default page : Blue</li><li><strong>URL </strong>: https://dev220523.service-now.com/x/1331190/handson/home/<strong>Red</strong>/params/shape/Square<br>output: From Variant Home page : Color is not Blue</li></ul><p>For a detailed explanation on this watch ServiceNow’s video :<br><a href="https://www.youtube.com/watch?v=5ZcP2cQ7uQw&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=4"><strong>https://www.youtube.com/watch?v=5ZcP2cQ7uQw&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=4</strong></a></p><h3><strong>4. Data Resources:</strong></h3><p>Data Resources enable the integration of external data sources or ServiceNow tables into UI components, facilitating real-time data display.<br>There are 6 types of data resource:</p><ul><li>GraphQL</li><li>Transform</li><li>Client state</li><li>Composite</li><li>REST</li><li>Scriptlet</li></ul><p>Data Resource Icon is found in Icon Bar in Lower part of the Icon Bar Column, Refer below screen shots for reference.<br>Click on that Bind Icon to open Data Resource page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*sNjCo4jURDQoA1t4jAFeLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xTlRLv8SJAudz6DuDWliug.png" /><figcaption>Reference for Data Resource Icon and Data Resource Page</figcaption></figure><ul><li>Lets Create a Look Up Records[To Fetch Data] from data resources.</li><li>In the Left is the configuration in the Right is the Preview</li><li>Select your table, select Return fields, Order By field, Sort, Max results[Here I have taken 1 as I want 1 result]</li><li>For text data bind <strong>@data.look_up_records_1.results.0.title.value</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Gd_Xe3ClZPNZA6YvFVlxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mdFnjd6mm6HOnTNwbdnWZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KJwDLVgAq7wxdKSPrMlC-A.png" /><figcaption>Reference to <strong>create a Look Up Record</strong> and<strong> Bind result data</strong> to a text</figcaption></figure><p>For a detailed explanation on this watch ServiceNow’s video :<br><a href="https://www.youtube.com/watch?v=otX50211pv4&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=5"><strong>https://www.youtube.com/watch?v=otX50211pv4&amp;list=PL3rNcyAiDYK0dbKPzncc05eFUPYQCs8Me&amp;index=5</strong></a></p><h3><strong>5. Conclusion</strong></h3><p>By following these step-by-step instructions, users can harness the potential of ServiceNow’s UI Builder to create dynamic and user-friendly interfaces for their applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94c5291b65f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Notes App in UIB ServiceNow]]></title>
            <link>https://sushmithabhat95.medium.com/building-a-notes-app-in-uib-servicenow-e92795d20051?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/e92795d20051</guid>
            <category><![CDATA[servicenow-training]]></category>
            <category><![CDATA[servicenow]]></category>
            <category><![CDATA[uib]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Wed, 01 May 2024 19:16:30 GMT</pubDate>
            <atom:updated>2024-05-03T12:32:38.697Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial provides a detailed explanation of the “ServiceNow Dev Program” and its corresponding video titled “Creator Toolbox — Viewports.”</p><p>Here is the link of the Source video :<br><a href="https://www.youtube.com/watch?v=PwZLd2phUZQ">https://www.youtube.com/watch?v=PwZLd2phUZQ</a></p><h3>Introduction</h3><p>In this tutorial, we’ll walk through the steps to create a simple Notes application using UIB in ServiceNow. This application will allow users to create, view, edit notes. We’ll cover each step in detail, providing explanations along the way.</p><p>Let’s get started!</p><h3>Table of Contents</h3><ol><li>Creating Notes Table</li><li>Creating a New Experience in UIB</li><li>Creating a Page with Sidebar</li><li>Adding a Button to Add New Note</li><li>Displaying Note Details</li><li>Displaying latest added note title</li><li>Conclusion</li></ol><h3>1. Creating Notes Table</h3><p>First, we need to create a table to store our notes. This table will contain two fields: Title and Body.</p><ol><li>Navigate to System Definition /Studio&gt; Tables. Click on New. Name the table Notes. Add two fields: Title (String) Body (String), Save the table.</li></ol><p>Now, our Notes table is ready to store our notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IKfhQcJdTOrqF1RXp6INiA.png" /><figcaption>Reference of Studio for table creation in My Notes App</figcaption></figure><h3>2. Creating a New Experience in UIB</h3><p>UIB (User Interface Builder) is a powerful tool in ServiceNow for creating user interfaces. Let’s create a new experience for our Notes app.</p><ol><li>Navigate to UIB &gt; Experiences.</li><li>Click on New Experience. In App Shell UI select “UXR Base Experience Shell”</li><li>Name the experience (e.g., Notes App).</li><li>Save the experience.</li></ol><p>We’ve created a new experience for our Notes app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OhlV9q_HvNHlWlE74qDLuw.png" /><figcaption>Reference to create new experience</figcaption></figure><h3>3. Creating a Page</h3><p>Now, let’s create a page to display our notes. We’ll include a sidebar to show the titles of the notes, sorted by the last updated date.<br>Let the Note Look like the picture below.</p><ol><li>Within the Notes App experience, click on New Page.</li><li>Name the page (e.g., Home Page).This will be the landing Page.</li><li>Add a component with Rich Text My Notes and Button named Save give an icon of your Choice.</li><li>Add one more component which has List display titles of notes sorted by last updated date. One more component ViewPort</li><li>Save the page.</li></ol><p>Our Home page with 4 components is ready.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MkMdo08V3ddqq3e3vVUxiQ.png" /><figcaption>Ignore Trial 1 for now</figcaption></figure><h4><strong>Configure the List component to fetch data from your “Notes” table:</strong></h4><ul><li>Click on the list component to select it.</li><li>In config, Table : Select your Table name (e.g., Notes).</li><li>In Columns add the field you want to display.</li><li>Number of Displayed Columns : 1</li><li>Header : Hide Header</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auc7irYtTqicJXkzxi_wGQ.png" /><figcaption>List mapping to Table Reference Image</figcaption></figure><h4><strong>Basic ViewPort :</strong></h4><ol><li>Click on the ViewPort, Edit Content then Save and continue.</li><li>Create a sub-page named “Notes Landing ctb”</li><li>Add a component with Rich Text, edit its HTML (e.g.,Welcome to viewPort).</li><li>To make this sub-page as the landing page in the parent. Click on body and click on its event. Add and Event on Page Ready.</li><li>Select “UXF Macroponent Viewport Load Requested”, where UXF is “User Experience FrameWork”, every page is Macroponent and we are requesting viewPort to load something.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gOPe8kqlrJ9mFXl5_bLK7Q.png" /><figcaption>Reference for Event to load Landing ViewPort</figcaption></figure><pre><br>//Here replace &quot;viewport_tsy&quot; with your ViewPort ID<br>//Here &quot;notes-landing-ctb&quot; is my Sub-page name<br>function evaluateEvent({api, event}) {<br> return {<br>  viewportElementId: &quot;viewport_tsy&quot;,<br>  route: &quot;notes-landing-ctb&quot;,<br>  fields: null,<br>  params: null<br> };<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yrazUqkiePnT9teqlH3OxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_N6m77dKtI9bqkbUBBbJhw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xg0wJKWmW76GQeOsrhyTgA.png" /><figcaption>Image are for reference how the UIB page looks</figcaption></figure><h3>4. Button to add New Note:</h3><p>As of the home landing page, we have button named “New Note”. On click of this button lets show a new viewPort where it takes input of Title and Body fields.</p><ol><li>Create new Sub-Page in ViewPort named “New Note CTB”</li><li>Add 3 components Input and Text Area and a button named Save.</li><li>Change the Label and Placeholder Text.</li><li>Edit Data , Client State and Client Scripts from Side Menu.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dW_FsKlh1hI45_ZjYuCFzw.png" /><figcaption>New Note CTB page reference</figcaption></figure><ol><li>Add Data resources in Data, select “Create Record”.</li><li>Add 2 Client state parameters in Client State, 1 : title, 2 : body.</li><li>Add a Page scripts in Client Scripts, Script name is “Create Note”</li></ol><pre>//We need to title and body from the Client state parameters through api<br>// &quot;create_record_1&quot; is my Data resources in Data on Create Record.<br>//This is my table Name &quot;x_1331190_my_notes_notes&quot;, Replace it with yours<br>//In &quot;templateFields&quot;: newQuery, Add the query created<br><br>function handler({api, event, helpers, imports}) {<br>    const newQuery = `title=${api.state.title}^body=${api.state.body}`;<br>    api.data.create_record_1.execute({<br>        &quot;table&quot;:&quot;x_1331190_my_notes_notes&quot;,<br>        &quot;templateFields&quot;: newQuery,<br>        &quot;useSetDisplayValue&quot;: false,<br>    });<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CheoC-ATc0G62udfFcfteg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxZfXB9k-yrk7U3k0pcnTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxAZrhkBZXXR_pA8aF9qsA.png" /><figcaption>Reference for Data , Client State and Client Scripts</figcaption></figure><p><strong>Creating Event for 3 components Input and Text Area and a button named Save</strong></p><ol><li>For Input and Text Area, set an event named Input value set.</li><li>For Input, Client State Parameter Name : “title”, New Value : “@payload.value”</li><li>For TextArea, Client State Parameter Name : “body”, New Value : “@payload.value”</li><li>For Save Button, Execute the selected client script here “Create Note”. Add this in “Add Event Handler”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OEMRMddcKc8VJtqzwmr3QA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CVvqbMy8MijNoAo6jXLWyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgLgmxpMiSPQc55NgoaOLQ.png" /><figcaption>Reference Image on <strong>Events for 3 components</strong></figcaption></figure><p><strong>Linking “New Note” Button to “New Note CTB” Sub-Page from ViewPort :</strong></p><ol><li>Now when the New Note is clicked from the parent create and event to load the New Note CTB Sub-Page from ViewPort.</li><li>To make this sub-page as the onClick page to the Button. Click on button and click on its event. Add and Event on Page Ready.</li><li>Select “UXF Macroponent Viewport Load Requested”, Update the function as below</li></ol><pre>//Here replace &quot;viewport_tsy&quot; with your ViewPort ID<br>//Here &quot;new-note-ctb&quot; is my Sub-page name<br>function evaluateEvent({api, event}) {<br> return {<br>  viewportElementId: &quot;viewport_tsy&quot;,<br>  route: &quot;new-note-ctb&quot;,<br>  fields: null,<br>  params: null<br> };<br>}</pre><h3>5. Displaying Note Details</h3><p>Let’s enable users to view and edit note details when they click on a note from the List. On Click of the List element populate the data in viewPort.</p><p><strong>Requirements :</strong></p><ol><li>Add a script to handle click events on note titles in the List.</li><li>When a note title is clicked, load the details (title and body) of that note in a pre-filled form.</li><li>Allow users to edit the note details.</li><li>On save, update the note in the database.</li><li>Save the changes.</li></ol><p><strong>Steps to achieve :</strong></p><ol><li>Create new Sub-Page in ViewPort named “Edit Note CTB”</li><li>Add 3 components Input and Text Area and a button named Save.</li><li>Change the Label and Placeholder Text.</li><li>Edit Data , Client State and Client Scripts from Side Menu.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2mG1KtOlY-C70qCKtyF5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfCnn53htgr5Tq4jmcDa0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fbp8YGygtdeI5X01zwN3pQ.png" /><figcaption>Reference for Data , Client State and Client Scripts</figcaption></figure><p><strong>Update Note Client Scripts:</strong></p><ol><li>Add Data resources in Data, select “Look Up Record” and “Update Record”.</li><li>Add 2 Client state parameters in Client State, 1 : title, 2 : body.<br> Initial value of “title” @data.look_up_notes.result.title.value, <br>Initial value of “body” @data.look_up_notes.result.body.value.</li><li>Add a Page scripts in Client Scripts, Script name is “Update Note”</li></ol><pre>function handler({api, event, helpers, imports}) {<br>    const noteSysId = api.context.props.noteId;<br>    const title = api.state.title;<br>    const body = api.state.body;<br>    const updateQuery = `title=${title}^body=${body}`;<br>    console.log(&quot;updateQuery :&quot;,updateQuery);<br>    api.data.update_note.execute({<br>        &quot;table&quot; : &quot;x_1331190_my_notes_notes&quot;,<br>        &quot;recordId&quot; : noteSysId,<br>        &quot;templateFields&quot; : updateQuery,<br>        &quot;useSetDisplayValue&quot; : false,<br>    });<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2mG1KtOlY-C70qCKtyF5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfCnn53htgr5Tq4jmcDa0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fbp8YGygtdeI5X01zwN3pQ.png" /><figcaption>Reference for Data , Client State and Client Scripts</figcaption></figure><p><strong>Creating Event for 3 components Input and Text Area and a button named Save</strong></p><ol><li>For Input and Text Area, set an event named Input value set.</li><li>For Input, Client State Parameter Name : “title”, New Value : “@payload.value”</li><li>For TextArea, Client State Parameter Name : “body”, New Value : “@payload.value”</li><li>For Save Button, Execute the selected client script here “Update Note”. Add this in “Add Event Handler”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6f0RhAPm1HsMcke4X-LSDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HoC9ht8Rk-1J1ffzW6kKDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bL3Y-LsYValVhYiHcok_jQ.png" /><figcaption>Reference Image on <strong>Events for 3 components</strong></figcaption></figure><p><strong>Linking note from List selected to “Edit Note CTB” Sub-Page from ViewPort :</strong></p><ol><li>Now when the note is clicked from the List create and event to load the Edit Note CTB Sub-Page from ViewPort.</li><li>To make this sub-page as the onClick page to the note. Click on List and click on its event. Add and Event on Reference link clicked/ Row Clicked.</li><li>Select “UXF Macroponent Viewport Load Requested”, Update the function as below</li></ol><pre>//Here replace &quot;viewport_tsy&quot; with your ViewPort ID<br>//Here &quot;edit-note-ctb&quot; is my Sub-page name<br>//Here we are sending a parameter noteId which is that note records sys_id<br>function evaluateEvent({api, event}) {<br> return {<br>  viewportElementId: &quot;viewport_tsy&quot;,<br>  route: &quot;edit-note-ctb&quot;,<br>  fields: null,<br>  params: {&quot;noteId&quot;:event.payload.sys_id}<br> };<br>}</pre><h3><strong>6. Displaying latest added note title :</strong></h3><h4><strong>Sending data from parent to child (ViewPort sub-page)</strong></h4><p>Displaying latest added note title in viewPort “Notes Landing ctb” page.<br>Now viewPort will access its data from “Home” page’s Data Resources.</p><p><strong>Data Resource from the side menu of “Home” Page :</strong></p><ol><li>Add Data resources in Data, select “Look Up Records” .<br>1.1 Select table as “Notes”<br>1.2 Edit condition, Sort by =&gt; Select “Created” field and descending Option as we need the latest note.<br>1.3 Make Max Result to 1 =&gt; I just want one result<br>1.4 Return fields =&gt; Select title as we need to display title of the note.</li><li>Add 1 Client state parameters in Client State, Name = “newestNote”.<br> Initial value of “newestNote” be @data.look_up_records_1.results.0.title.value</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4TH-sAux5_A3HN0hTo6PkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qzPjwE5eArZbA2O4Elo5bw.png" /><figcaption>Reference for Data , Client State for Home page</figcaption></figure><p><strong>“Notes Landing ctb” Page :</strong></p><ol><li>Click on body =&gt; Select its config =&gt; Create a new Property by Clicking on “Edit” =&gt; Give the property name “newNote”</li><li>Property “newNote” will be assigned the value from “Home” which is parent page as “@data.look_up_records_1.results.0.title.value”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cf8JzwWRkcGNwjErEGsduQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uNUp6LjP4wlns8FBgQxreQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*huJLCZCCXOqSiTdhYpHMFw.png" /><figcaption>Reference for property “newNote” and it value &amp; new Styled Text component added</figcaption></figure><ol><li>Add 1 component Styled Text, the newest Note will be displayed here.</li><li>Select its config =&gt;Bind the data for text as “@context.props.newNote”</li></ol><h3><strong>Conclusion:</strong></h3><p>This tutorial has equipped you with the essential steps to create a robust Notes application in UIB ServiceNow. By following these instructions, you can efficiently manage, edit notes while enhancing user experience with clear feedback messages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e92795d20051" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rest API’s in ServiceNow]]></title>
            <link>https://sushmithabhat95.medium.com/rest-apis-in-servicenow-5802759914d9?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/5802759914d9</guid>
            <category><![CDATA[servicenow-implementation]]></category>
            <category><![CDATA[servicenow]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[servicenow-integration]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Wed, 17 Apr 2024 02:57:06 GMT</pubDate>
            <atom:updated>2024-04-17T06:45:20.368Z</atom:updated>
            <content:encoded><![CDATA[<p>REST APIs in ServiceNow help different software systems talk to each other, like a universal translator. They allow ServiceNow to share its data and functions with other applications easily, making it more flexible and integrated with the broader technology ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLw5wW3oopeOUsES78Jzrg.png" /><figcaption>Source : <a href="https://beingfluid.in/IntegrateNow/images/app_store_learnv2_rest_sandiego_inbound_images_inbound_genericrequest.png">https://beingfluid.in/IntegrateNow/images/app_store_learnv2_rest_sandiego_inbound_images_inbound_genericrequest.png</a></figcaption></figure><h3>Table of Contents:</h3><ol><li>Introduction</li><li>Setting Up ServiceNow Development Environment</li><li>Creating a Custom Table for Book Data</li><li>Writing a Script Include for Book Operations</li><li>Developing a Scripted REST API for Book Management</li><li>Testing Book API Endpoints in REST API Explorer</li><li>Conclusion</li></ol><h4>1. Introduction:</h4><p>In this article, we’ll explore how to create a custom Book API in ServiceNow. We’ll walk through the process of setting up the development environment, creating a custom table to store book data, writing a Script Include to encapsulate book operations, and developing a Scripted REST API to expose endpoints for interacting with the book data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fdFXOPQtdM3ZiDQ-Txz2GA.png" /><figcaption>Overview of how scriptInclude is connected to Scripted Rest API to get the EndPoints</figcaption></figure><h4>2. Setting Up ServiceNow Development Environment:</h4><ul><li>Sign in to your ServiceNow instance.</li><li>Navigate to the Studio application.</li><li>Create a new application for the Book API development. Here in this example I have named LibraryBook .</li></ul><h4>3. Creating a Custom Table for Book Data:</h4><ul><li>Go to System Definition &gt; Tables.</li><li>Create a new table definition named Book and scope be likex_1331190_libraryb_book</li><li>Add fields such as Title, Author, and ISBN to store book information.</li></ul><h4>4. Writing a Script Include for Book Operations:</h4><ul><li>Go to System Definition &gt; Script Includes.</li><li>Create a new Script Include named BookAPI.</li><li>Write JavaScript functions to encapsulate CRUD operations for managing book data.</li></ul><p><strong>ScriptInclude Script :</strong></p><pre>var BookAPI = Class.create(); // Define a new class for the BookAPI<br>BookAPI.prototype = { // Define the prototype methods for the BookAPI class<br>    initialize: function() {}, // Constructor function, no initialization needed<br>    <br>    // Function to retrieve all books from the custom table<br>    getAllBooks: function() {<br>        var bookList = []; // Initialize an empty array to store books<br>        var bookGR = new GlideRecord(&quot;x_1331190_libraryb_book&quot;); // Create a new GlideRecord object for the custom table<br>        bookGR.query(); // Execute a query to retrieve all records from the table<br>        while (bookGR.next()) { // Loop through each record in the GlideRecord<br>            var book = { // Create an object to represent a book<br>                id: bookGR.getUniqueValue(), // Get the unique identifier of the book record<br>                title: bookGR.getValue(&quot;title&quot;), // Get the title of the book<br>                author: bookGR.getValue(&quot;author&quot;), // Get the author of the book<br>                isbn: bookGR.getValue(&quot;isbn&quot;) // Get the ISBN of the book<br>            };<br>            bookList.push(book); // Add the book object to the array<br>        }<br>        return bookList; // Return the array of books<br>    },<br><br>    // Function to retrieve a book by its ID<br>    getBookByID: function(bookID) {<br>        var bookGR = new GlideRecord(&quot;x_1331190_libraryb_book&quot;);<br>        if (bookGR.get(bookID)) { // Check if a book with the given ID exists<br>            var book = { <br>                id: bookGR.getUniqueValue(),<br>                title: bookGR.getValue(&quot;title&quot;),<br>                author: bookGR.getValue(&quot;author&quot;), <br>                isbn: bookGR.getValue(&quot;isbn&quot;) <br>            };<br>            return book; // Return the book object<br>        } else {<br>            return null; // Return null if the book is not found<br>        }<br>    },<br><br>    // Function to create a new book record<br>    createBook: function(title, author, isbn) {<br>        var bookGR = new GlideRecord(&quot;x_1331190_libraryb_book&quot;); // Create a new GlideRecord object<br>        bookGR.initialize(); // Initialize the GlideRecord for insertion<br>        bookGR.setValue(&quot;Title&quot;, title); // Set the title of the book<br>        bookGR.setValue(&quot;Author&quot;, author); // Set the author of the book<br>        bookGR.setValue(&quot;ISBN&quot;, isbn); // Set the ISBN of the book<br>        var bookID = bookGR.insert(); // Insert the book record into the table and get the unique identifier<br>        return bookID; // Return the unique identifier of the newly created book<br>    },<br><br>    // Function to update an existing book record<br>    updateBook: function(bookID, title, author, isbn) {<br>        var bookGR = new GlideRecord(&quot;x_1331190_libraryb_book&quot;); // Create a new GlideRecord object<br>        bookGR.query(); // Execute a query to retrieve records from the table<br>        if (bookGR.get(bookID[0])) { // Check if a book with the given ID exists<br>            bookGR.setValue(&quot;title&quot;, title); // Set the title of the book<br>            bookGR.setValue(&quot;author&quot;, author); // Set the author of the book<br>            bookGR.setValue(&quot;isbn&quot;, isbn); // Set the ISBN of the book<br>            bookGR.update(); // Update the book record in the table<br>            return true; // Return true to indicate successful update<br>        } else {<br>            return false; // Return false if the book is not found<br>        }<br>    },<br><br>    // Function to delete an existing book record<br>    deleteBook: function(bookID) {<br>        var bookGR = new GlideRecord(&quot;x_1331190_libraryb_book&quot;); // Create a new GlideRecord object<br>        if (bookGR.get(bookID[0])) { // Check if a book with the given ID exists<br>            bookGR.deleteRecord(); // Delete the book record from the table<br>            return true; // Return true to indicate successful deletion<br>        } else {<br>            return false; // Return false if the book is not found<br>        }<br>    },<br><br>    type: &#39;BookAPI&#39; // Define the type of the BookAPI class<br>};</pre><h4>5. Developing a Scripted REST API for Book Management:</h4><ul><li>Go to System Web Services &gt; Scripted REST APIs.</li><li>Create a new Scripted REST API named BookAPI.</li><li>Write JavaScript code to handle HTTP requests (GET, POST, PUT, DELETE) for book management using the functions defined in the BookAPI Script Include.</li><li>Name of the API is book_api</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mSyoq9TlA3Ed_2aKCTWWDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jeC6qrIA8bljcyVmMQ18-Q.png" /><figcaption>Handle HTTP requests in Scripted Rest Service</figcaption></figure><p>Create New API request as shown in second slide above. Inside that request write your scripts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJtyoeh_FU-SGfRh_1je5w.png" /><figcaption>Script for GET request</figcaption></figure><pre>// GET Method<br><br>(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {<br> try{<br>    var queryParams = request.queryParams; // Get the query parameters from the request<br>    var bookAPI = new x_1331190_libraryb.BookAPI(); // Create an instance of the BookAPI class<br>    var result = {}; // Initialize an empty object to store the result<br> if (queryParams &amp;&amp; queryParams.id) { // Check if query parameters contain an ID<br>                // If there is an ID in query parameters, retrieve a single book<br>                result = bookAPI.getBookByID(queryParams.id);<br>            } else {<br>                // If no ID is provided, retrieve all books<br>                result = bookAPI.getAllBooks();<br>            }<br>    response.setStatus(200); // Set the HTTP response status to 200 (OK)<br>    response.setContentType(&#39;application/json&#39;); // Set the content type of the response to JSON<br>    response.getStreamWriter().writeString(JSON.stringify(result)); // Write the result object as a JSON string to the response<br> }catch(error){<br>  response.setStatus(500); // Set the HTTP response status to 500 (Internal Server Error)<br>  response.setBody({<br>   message:&quot;Please wait,something has caughtup...!&quot;, // Set a generic error message<br>   err:error.toString() // Set the error details in the response body<br>  });<br> }<br><br>})(request, response); // Execute the anonymous function with the provided request and response objects</pre><pre>//POST Method<br><br>(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {<br>  try {<br>    var queryParams = request.queryParams; // Get the query parameters from the request<br>    var requestBody = JSON.stringify(request.body.dataString); // Get the request body data as a JSON string<br><br>    var bookAPI = new x_1331190_libraryb.BookAPI(); // Create an instance of the BookAPI class<br>    var result = {}; // Initialize an empty object to store the result<br><br>    // Call the createBook function of the BookAPI class with data from the request body<br>    result = bookAPI.createBook(<br>      requestBody.title,<br>      requestBody.author,<br>      requestBody.isbn<br>    );<br><br>    response.setStatus(200); // Set the HTTP response status to 200 (OK)<br>    response.setContentType(&quot;application/json&quot;); // Set the content type of the response to JSON<br>    response.getStreamWriter().writeString(JSON.stringify(result)); // Write the result object as a JSON string to the response<br>  } catch (error) {<br>    response.setStatus(500); // Set the HTTP response status to 500 (Internal Server Error)<br>    response.setBody({<br>      message: &quot;Please wait, something has caught up...!&quot;, // Set a generic error message<br>      err: error.toString(), // Set the error details in the response body<br>    });<br>  }<br>})(request, response); // Execute the anonymous function with the provided request and response objects</pre><pre>//PUT Method<br><br>(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {<br>  try {<br>    var queryParams = request.queryParams; // Get the query parameters from the request<br>    // var requestBody = JSON.stringify(request.body.dataString); //Dont do stringify here<br>    var requestBody = request.body.data; // Get the request body data<br><br>    var bookAPI = new x_1331190_libraryb.BookAPI(); // Create an instance of the BookAPI class<br>    var result = {}; // Initialize an empty object to store the result<br><br>    // Call the updateBook function of the BookAPI class with data from the request body<br>    result = bookAPI.updateBook(<br>      queryParams.id,<br>      requestBody.title,<br>      requestBody.author,<br>      requestBody.isbn<br>    );<br><br>    response.setStatus(200); // Set the HTTP response status to 200 (OK)<br>    response.setContentType(&quot;application/json&quot;); // Set the content type of the response to JSON<br>    response.getStreamWriter().writeString(JSON.stringify(result)); // Write the result object as a JSON string to the response<br>  } catch (error) {<br>    response.setStatus(500); // Set the HTTP response status to 500 (Internal Server Error)<br>    response.setBody({<br>      message: &quot;Please wait, something has caught up...!&quot;, // Set a generic error message<br>      err: error.toString(), // Set the error details in the response body<br>    });<br>  }<br>})(request, response); // Execute the anonymous function with the provided request and response objects</pre><pre>//DELETE Method<br><br>(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {<br>  try {<br>    var queryParams = request.queryParams; // Get the query parameters from the request<br><br>    var bookAPI = new BookAPI(); // Create an instance of the BookAPI class<br>    var result = {}; // Initialize an empty object to store the result<br><br>    // Call the deleteBook function of the BookAPI class with the book ID from query parameters<br>    result = bookAPI.deleteBook(queryParams.id);<br><br>    response.setStatus(200); // Set the HTTP response status to 200 (OK)<br>    response.setContentType(&quot;application/json&quot;); // Set the content type of the response to JSON<br>    response.getStreamWriter().writeString(JSON.stringify(result)); // Write the result object as a JSON string to the response<br>  } catch (error) {<br>    response.setStatus(500); // Set the HTTP response status to 500 (Internal Server Error)<br>    response.setBody({<br>      message: &quot;Please wait, something has caught up...!&quot;, // Set a generic error message<br>      err: error.toString(), // Set the error details in the response body<br>    });<br>  }<br>})(request, response); // Execute the anonymous function with the provided request and response objects</pre><h4>6. Testing Book API Endpoints in REST API Explorer:</h4><ul><li>Go to System Web Services &gt; REST API Explorer.</li><li>Find the BookAPI Scripted REST API and expand it.</li><li>Test each endpoint using the provided interface.</li><li>Use request body to pass data to the endpoints (e.g., create, update) and observe the responses.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBCFG17UR88XTYseX4vhAg.png" /><figcaption>Screenshot of the RestAPI Explorer page</figcaption></figure><p>Request Body for POST request looks like :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7ZPdCtaTyP83xekW27A9w.png" /><figcaption>post request body</figcaption></figure><p>Response Body for POST request :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*720vau8ZHlkbACA-gkI_RA.png" /><figcaption>Response for post request</figcaption></figure><p>For PUT request enter the JSON in below format:</p><pre>//PUT and POST request Request Body<br><br>{<br>  &quot;title&quot;: &quot;New Book Title&quot;,<br>  &quot;author&quot;: &quot;Author Name&quot;,<br>  &quot;isbn&quot;: &quot;ISBN Number&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9wdMrl3MYqoJ8Aondahcg.png" /><figcaption>enter the JSON in Raw block</figcaption></figure><h4>7. Conclusion:</h4><p>I’ve demonstrated the step-by-step process of creating a custom Book API in ServiceNow, from setting up the development environment to testing endpoints in REST API Explorer. Feel free to let me know any changes required in this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5802759914d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Developer Scripts in ServiceNow]]></title>
            <link>https://sushmithabhat95.medium.com/understanding-developer-scripts-in-servicenow-2c9a6ea42130?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c9a6ea42130</guid>
            <category><![CDATA[servicenow]]></category>
            <category><![CDATA[servicenow-development]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Fri, 05 Apr 2024 17:14:19 GMT</pubDate>
            <atom:updated>2024-04-10T10:30:32.774Z</atom:updated>
            <content:encoded><![CDATA[<p>ServiceNow offers a robust platform for building enterprise applications, workflows, and automations. Developer scripts play a crucial role in customizing and extending the functionality of ServiceNow instances.</p><p>Table of Contents:</p><ol><li>Mastering GlideRecord</li><li>Exploring GlideAjax</li><li>Harnessing the Power of GlideSystem</li><li>Understanding GlideForm</li><li>Simplifying Date Operations with GlideDate</li><li>Conclusion: Your Path to ServiceNow Scripting Mastery</li></ol><h3>Mastering GlideRecord<strong>:</strong></h3><p>GlideRecord is like a special tool that helps us interact with the database.<br>GlideRecord is essential in ServiceNow because it gives us the power to work with the data in the system, whether it’s finding, updating, creating, or organizing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*kMdWJj28-iAjOAyj6nP7dg.png" /><figcaption>Source : <a href="https://images.squarespace-cdn.com/content/v1/56709605c647ada061ec9ed8/04fff366-57f3-4540-a03c-1a82d5c14094/ill+make+my+own+gliderecord.png?format=1500w">https://images.squarespace-cdn.com/content/v1/56709605c647ada061ec9ed8/04fff366-57f3-4540-a03c-1a82d5c14094/ill+make+my+own+gliderecord.png?format=1500w</a></figcaption></figure><pre>// 1. Create an object to store rows from a table<br>var myObj = new GlideRecord(&#39;table_name&#39;);<br><br>// 2. Build query<br>myObj.addQuery(&#39;field_name&#39;,&#39;operator&#39;,&#39;value&#39;);<br>myObj.addQuery(&#39;field_name&#39;,&#39;operator&#39;,&#39;value&#39;);<br><br>// 3. Execute query <br>myObj.query();<br><br>// 4. Process returned records<br>while(myObj.next()){<br>  //Logic you want to execute.  <br>  //Use myObj.field_name to reference record fields<br>}</pre><pre>//Methods:<br><br>1) addQuery(field, operator, value):<br><br>Input: Field name, operator, value<br>Output: None<br>Example: gr.addQuery(&#39;field_name&#39;, &#39;=&#39;, &#39;value&#39;);<br><br>//---------------------------------------------------------------<br><br>2) query(queryString):<br><br>Input: Query string (optional)<br>Output: Records that match the query<br>Example: gr.query();<br><br>//---------------------------------------------------------------<br><br>3) get(sysIdOrQuery):<br><br>Input: sys_id or query string<br>Output: Single record matching the specified criteria<br>Example: gr.get(&#39;sys_id&#39;);<br><br>//---------------------------------------------------------------<br><br>4) getValue(field):<br><br>Input: Field name<br>Output: Value of the specified field on the current record<br>Example: var value = gr.getValue(&#39;field_name&#39;);<br><br>//---------------------------------------------------------------<br><br>5) setValue(field, value):<br><br>Input: Field name, value<br>Output: None<br>Example: gr.setValue(&#39;field_name&#39;, &#39;new_value&#39;);<br><br>//---------------------------------------------------------------<br><br>6) insert():<br><br>Input: None<br>Output: sys_id of the inserted record<br>Example: var sysId = gr.insert();<br><br>//---------------------------------------------------------------<br><br>7) update():<br><br>Input: None<br>Output: None<br>Example: gr.update();<br><br>//---------------------------------------------------------------<br><br>8) deleteRecord():<br><br>Input: None<br>Output: None<br>Example: gr.deleteRecord();<br><br>//---------------------------------------------------------------<br><br>9) next():<br><br>Input: None<br>Output: Moves to the next record in the result set<br>Example: while (gr.next()) { //do something }<br><br>//---------------------------------------------------------------<br><br>10) hasNext():<br><br>Input: None<br>Output: True if there is a next record, otherwise false<br>Example: if (gr.hasNext()) { //do something }<br><br>//---------------------------------------------------------------<br><br>11) addEncodedQuery(query):<br>Input: Encoded query string<br>Returns: None<br>Example: gr.addEncodedQuery(&#39;encoded_query_string&#39;);</pre><h3><strong>Exploring GlideAjax :</strong></h3><p>When you need to send some information to the server or ask for something from the server without reloading the whole page, you use GlideAjax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPxQpv1K4aBIhUVWxhxA5Q.png" /><figcaption>Source : <a href="https://media.licdn.com/dms/image/D5612AQGEkWOpJD06CA/article-cover_image-shrink_720_1280/0/1701687297034?e=1718236800&amp;v=beta&amp;t=MHzH2qJbAG-DGv0PJRgZjkhDsFAM92LvSU3rt8cXZFs">https://media.licdn.com/dms/image/D5612AQGEkWOpJD06CA/article-cover_image-shrink_720_1280/0/1701687297034?e=1718236800&amp;v=beta&amp;t=MHzH2qJbAG-DGv0PJRgZjkhDsFAM92LvSU3rt8cXZFs</a></figcaption></figure><pre>var ga = new GlideAjax(&#39;HelloWorld&#39;); // HelloWorld is the script include class <br>ga.addParam(&#39;sysparm_name&#39;,&#39;helloWorld&#39;); // helloWorld is the script include method <br>ga.addParam(&#39;sysparm_user_name&#39;,&quot;Bob&quot;); // Set parameter sysparm_user_name to &#39;Bob&#39; <br>ga.getXML(HelloWorldParse);  /* Call HelloWorld.helloWorld() with the parameter sysparm_user_name set to &#39;Bob&#39; <br>      and use the callback function HelloWorldParse() to return the result when ready */<br><br>// the callback function for returning the result from the server-side code<br>function HelloWorldParse(response) {  <br>   var answer = response.responseXML.documentElement.getAttribute(&quot;answer&quot;); <br>    alert(answer);<br>}</pre><pre><br><br>// Methods:<br><br>addParam(name, value):<br><br>Input: Parameter name, value<br>Output: None<br>Example: glideAjax.addParam(&#39;param_name&#39;, &#39;param_value&#39;);<br><br>//---------------------------------------------------------------<br><br>getXML(callback):<br><br>Input: Callback function<br>Output: None (Executes the AJAX request and invokes the callback function with the response)<br>Example:<br>glideAjax.getXML(function(response) {<br>// Process response<br>});<br><br>//---------------------------------------------------------------<br><br>getXMLAnswer(callback):<br><br>Input: Callback function<br>Output: None (Executes the AJAX request and invokes the callback function with the response answer)<br>Example:<br>glideAjax.getXMLAnswer(function(answer) {<br>// Process answer<br>});<br><br>//---------------------------------------------------------------<br><br>setXMLAnswer(answer):<br><br>Input: Answer string<br>Output: None<br>Example: glideAjax.setXMLAnswer(&#39;answer_string&#39;);<br><br>//---------------------------------------------------------------<br><br>getURL():<br><br>Input: None<br>Output: Returns the URL for the AJAX call<br>Example: var url = glideAjax.getURL();<br><br>//---------------------------------------------------------------<br><br>getParameter():<br><br>Input: None<br>Output: Returns the parameter map<br>Example: var params = glideAjax.getParameter();<br><br>//---------------------------------------------------------------<br><br>getError():<br><br>Input: None<br>Output: Returns the error message if an error occurred during the AJAX call<br>Example: var error = glideAjax.getError();<br><br>//---------------------------------------------------------------<br><br>getProcessor():<br><br>Input: None<br>Output: Returns the ScriptIncludeName associated with the GlideAjax object<br>Example: var processor = glideAjax.getProcessor();<br><br>//---------------------------------------------------------------<br><br>setProcessor(name):<br><br>Input: ScriptIncludeName<br>Output: None<br>Example: glideAjax.setProcessor(&#39;NewScriptIncludeName&#39;);<br><br>//---------------------------------------------------------------<br><br>getHeader(headerName):<br><br>Input: Header name<br>Output: Returns the value of the specified header in the AJAX response<br>Example: var headerValue = glideAjax.getHeader(&#39;headerName&#39;);</pre><h3><strong>Harnessing the Power of GlideSystem:</strong></h3><p>GlideSystem is like the behind-the-scenes wizard in ServiceNow,<br>It handles tasks like organizing customer requests and automating processes, making life easier for businesses.</p><pre>// Create GlideSystem:<br>var gs = new GlideSystem();<br><br>gs.log(&quot;This is a log message.&quot;);<br>var dateTime = gs.getCurrentDateTime();<br>gs.addProperty(&quot;example.property&quot;, &quot;exampleValue&quot;);<br>gs.addErrorMessage(&quot;This is an error message.&quot;);<br>var jobId = gs.scheduleScript(&quot;ScriptIncludeName&quot;,&quot;functionName&quot;, &quot;argument1&quot;, &quot;argument2&quot;);</pre><pre><br>// Methods:<br><br>Logging and Debugging:<br>log()<br><br>Input: String message to log.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>debug()<br><br>Input: String message for debugging.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>Date and Time:<br>getCurrentDateTime()<br><br>Input: None<br>Output: Current date and time in GlideDateTime format.<br><br>//---------------------------------------------------------------<br><br>getDate()<br><br>Input: GlideDateTime object.<br>Output: Date portion of the provided GlideDateTime.<br><br>//---------------------------------------------------------------<br><br>getTimeOfDay()<br><br>Input: GlideDateTime object.<br>Output: Time portion of the provided GlideDateTime.<br><br>//---------------------------------------------------------------<br><br>Properties:<br>getProperty()<br><br>Input: Property name as a string.<br>Output: Value of the specified property.<br><br>//---------------------------------------------------------------<br><br>setProperty()<br><br>Input: Property name and value as strings.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>getPropertyNames()<br><br>Input: None<br>Output: Array of property names.<br><br>//---------------------------------------------------------------<br><br>Messages and Notifications:<br>addErrorMessage()<br><br>Input: Error message as a string.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>addInfoMessage()<br><br>Input: Information message as a string.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>addWarningMessage()<br><br>Input: Warning message as a string.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>Script Execution:<br>executeNow()<br><br>Input: Script include name and function name as strings, and optional arguments.<br>Output: Result of the executed script.<br><br>//---------------------------------------------------------------<br><br>scheduleScript()<br><br>Input: Script include name and function name as strings, and optional arguments.<br>Output: Sys_id of the scheduled job.<br><br>//---------------------------------------------------------------<br><br>User and Session:<br>getUserID()<br><br>Input: None<br>Output: User ID of the currently logged-in user.<br><br>//---------------------------------------------------------------<br><br>getSession()<br><br>Input: None<br>Output: Session object for the current users session.<br><br>//---------------------------------------------------------------<br><br>Database Operations:<br>update()<br><br>Input: GlideRecord object representing the record to update.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>insert()<br><br>Input: GlideRecord object representing the record to insert.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>query()<br><br>Input: Query string.<br>Output: GlideRecord object representing the result set.<br><br>//---------------------------------------------------------------<br><br>System Information:<br>getSystemID()<br><br>Input: None<br>Output: System ID of the current instance.<br><br>//---------------------------------------------------------------<br><br>getInstanceName()<br><br>Input: None<br>Output: Name of the current instance.<br><br>//---------------------------------------------------------------<br><br>Email:<br>sendEmail()<br>Input: Email details such as sender, recipient, subject, and body.<br>Output: None<br><br>//---------------------------------------------------------------<br><br>Attachments:<br>writeAttachment()<br>Input: Table name, record sys_id, file name, and file content.<br>Output: Sys_id of the attachment created.<br></pre><h3>Understanding GlideForm:</h3><p>GlideForm in ServiceNow is like the toolkit for creating and managing forms. It ensures forms work smoothly, data is saved correctly, and customization is easy, making the whole form experience user-friendly and efficient.</p><pre>// Accessing GlideForm:<br>var g_form = new GlideForm(&#39;sys_id&#39;);</pre><pre><br>// Methods:<br><br>addErrorMessage(message):<br><br>Input: Error message<br>Output: None<br>Example: g_form.addErrorMessage(&#39;Invalid input!&#39;);<br><br>//---------------------------------------------------------------<br><br>addInfoMessage(message):<br><br>Input: Information message<br>Output: None<br>Example: g_form.addInfoMessage(&#39;Record saved successfully!&#39;);<br><br>//---------------------------------------------------------------<br><br>addFieldMsg(field, message, type):<br><br>Input: Field name, message, message type (&#39;info&#39;, &#39;warning&#39;, &#39;error&#39;)<br>Output: None<br>Example: g_form.addFieldMsg(&#39;field_name&#39;, &#39;Please provide valid input.&#39;, &#39;error&#39;);<br><br>//---------------------------------------------------------------<br><br>getBooleanValue(field):<br><br>Input: Field name<br>Output: Boolean value of the specified field<br>Example: var value = g_form.getBooleanValue(&#39;field_name&#39;);<br><br>//---------------------------------------------------------------<br><br>getDisplayValue(field):<br><br>Input: Field name<br>Output: Display value of the specified field<br>Example: var displayValue = g_form.getDisplayValue(&#39;field_name&#39;);<br><br>//---------------------------------------------------------------<br><br>getValue(field):<br><br>Input: Field name<br>Output: Value of the specified field<br>Example: var value = g_form.getValue(&#39;field_name&#39;);<br><br>//---------------------------------------------------------------<br><br>setValue(field, value, displayValue):<br><br>Input: Field name, value, display value (optional)<br>Output: None<br>Example: g_form.setValue(&#39;field_name&#39;, &#39;new_value&#39;, &#39;New Display Value&#39;);<br><br>//---------------------------------------------------------------<br><br>setReadOnly(field, isReadOnly):<br><br>Input: Field name, boolean value indicating read-only status<br>Output: None<br>Example: g_form.setReadOnly(&#39;field_name&#39;, true);<br><br>//---------------------------------------------------------------<br><br>save():<br><br>Input: None<br>Output: None<br>Example: g_form.save();<br><br>//---------------------------------------------------------------<br><br>submit():<br><br>Input: None<br>Output: None<br>Example: g_form.submit();</pre><h3><strong>Simplifying Date Operations with GlideDate:</strong></h3><p>GlideDate facilitates working with date and time values. It offers methods for parsing, formatting, and manipulating dates.</p><pre>// Creating a GlideDate instance<br>var gd = new GlideDate();<br>// Getting the current date<br>var currentDate = gd.getDisplayValue();</pre><pre>// Methods:<br><br>getNumericValue():<br><br>Input: None<br>Output: Returns the numeric value of the date in milliseconds since January 1, 1970, 00:00:00 UTC.<br>Example: var numericValue = glideDate.getNumericValue();<br><br>//---------------------------------------------------------------<br><br>getDayOfMonthLocalTime():<br><br>Input: None<br>Output: Returns the day of the month using local time.<br>Example: var dayOfMonth = glideDate.getDayOfMonthLocalTime();<br><br>//---------------------------------------------------------------<br><br>getDisplayValue():<br><br>Input: None<br>Output: Returns the date in the current users display format and time zone.<br>Example: var displayValue = glideDate.getDisplayValue();<br><br>//---------------------------------------------------------------<br><br>getDisplayValueInternal():<br><br>Input: None<br>Output: Returns the date in the systems internal format and time zone.<br>Example: var internalDisplayValue = glideDate.getDisplayValueInternal();<br><br>//---------------------------------------------------------------<br><br>getDayOfMonth():<br><br>Input: None<br>Output: Returns the day of the month using the UTC time zone.<br>Example: var dayOfMonthUTC = glideDate.getDayOfMonth();<br><br>//---------------------------------------------------------------<br><br>getMonthLocalTime():<br><br>Input: None<br>Output: Returns the month using local time.<br>Example: var monthLocal = glideDate.getMonthLocalTime();<br><br>//---------------------------------------------------------------<br><br>getMonthUTC():<br><br>Input: None<br>Output: Returns the month using the UTC time zone.<br>Example: var monthUTC = glideDate.getMonthUTC();<br><br>//---------------------------------------------------------------<br><br>getYearLocalTime():<br><br>Input: None<br>Output: Returns the year using local time.<br>Example: var yearLocal = glideDate.getYearLocalTime();<br><br>//---------------------------------------------------------------<br><br>getYearUTC():<br><br>Input: None<br>Output: Returns the year using the UTC time zone.<br>Example: var yearUTC = glideDate.getYearUTC();<br><br>//---------------------------------------------------------------<br><br>setValue(dateString):<br><br>Input: Date string in &quot;yyyy-MM-dd&quot; format.<br>Output: None<br>Example: glideDate.setValue(&#39;2024-03-31&#39;);</pre><h3><strong>Conclusion:</strong></h3><p>With this simplified guide and practical examples, you’re well on your way to harnessing the full potential of developer scripts in ServiceNow. Happy scripting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c9a6ea42130" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Getting To Know ServiceNow: Simplifying Workflows and Boosting Productivity”]]></title>
            <link>https://sushmithabhat95.medium.com/mastering-servicenow-simplifying-workflows-and-boosting-productivity-05c785ccc642?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/05c785ccc642</guid>
            <category><![CDATA[servicenow-integration]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[servicenow-development]]></category>
            <category><![CDATA[servicenow]]></category>
            <category><![CDATA[business-rules]]></category>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Fri, 15 Mar 2024 18:02:37 GMT</pubDate>
            <atom:updated>2024-04-10T10:37:22.996Z</atom:updated>
            <content:encoded><![CDATA[<p>ServiceNow is a cloud-based platform that provides a wide range of IT service management (ITSM) and business management solutions.<br>In development, ServiceNow is utilised for creating and testing custom applications, automating development workflows, and managing software development lifecycles.</p><h3><strong>Table of Contents:</strong></h3><ol><li>Business Rule</li><li>UI Policies</li><li>UI Action</li><li>Relationships</li><li>Roles</li><li>Groups</li><li>Workflows</li><li>Notification</li><li>Table &amp; Fields</li><li>Client Script</li><li>Script Include</li><li>Import Data</li><li>Schedule jobs</li><li>Report</li><li>Rough Guide</li><li>Different Types of ServiceNow and how they are triggered</li></ol><h3><strong>Business Rule:</strong></h3><ul><li>Business Rules in ServiceNow allow you to automate tasks and enforce business logic without manual intervention.Automate tasks and enforce business logic with custom scripts triggered by data changes. They consist of conditions and scripts triggered by data changes, such as record creation or update.<br>Example: Automatically assign priority levels to incoming incidents based on urgency.<br>The <em>When</em> option determines when, relative to database access, Business Rule logic executes: <em>before, after, async, display</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fs53p4wM2PNN6yFWtA8DVw.png" /><figcaption>Source :<a href="https://developer.servicenow.com/app_store_learnv2_scripting_utah_serverscripting_images_script_brprocessflow.png">https://developer.servicenow.com/app_store_learnv2_scripting_utah_serverscripting_images_script_brprocessflow.png</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0N0-a0FqIuUEmEcRgZtQ5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UjVlcxIlt0PblVi5icqNew.png" /><figcaption>Script example for business rule</figcaption></figure><h3><strong>UI Policies:</strong></h3><ul><li>UI Policies dynamically control field behavior on forms based on predefined conditions to improve user experience. They can make fields mandatory, read-only, visible, or hidden to improve the user experience.<br>Example: Hide sensitive fields for non-admin users on the incident form.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gwrUUKP6A7VU2EK5weyoQ.png" /><figcaption>Source :<a href="https://www.learnnowlab.com/assets/img/uip4.PNG">https://www.learnnowlab.com/assets/img/uip4.PNG</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aYddfWjOiGiE2wtLnaCHQ.png" /><figcaption>Source :<a href="https://www.learnnowlab.com/assets/img/uip9.PNG">https://www.learnnowlab.com/assets/img/uip9.PNG</a></figcaption></figure><h3><strong>UI Action:</strong></h3><ul><li>UI Actions add custom buttons or links to perform specific actions, enhancing user productivity. They provide users with quick access to commonly used functions and enhance productivity. <br>Example: Create a “Close” button on the incident form to expedite closure.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILl74sMYHiujNabBIJukYA.png" /><figcaption>Source :<a href="https://www.learnnowlab.com/assets/img/uia2.PNG">https://www.learnnowlab.com/assets/img/uia2.PNG</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*k0RcJMEC4V7hNmLZKQ-9fA.png" /><figcaption>Source :<a href="https://www.learnnowlab.com/assets/img/uia3.PNG">https://www.learnnowlab.com/assets/img/uia3.PNG</a></figcaption></figure><h3><strong>Relationships:</strong></h3><ul><li>Relationships define connections between records in ServiceNow, establishing dependencies and associations between them. They enable data linking and navigation across related records.<br> Example: Link Games records to Reviews records.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzIIe6ys7Br1hK_jIrJhcg.png" /></figure><h3><strong>Roles:</strong></h3><ul><li>Roles in ServiceNow define sets of permissions and access rights assigned to users or groups. They control what users can do within the system and restrict unauthorized actions.<br>Example: Grant ‘Approver’ role to managers for approving change requests.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*4-CRoqY96U4UKskB6T7dBg.png" /><figcaption>Source :<a href="https://developer.servicenow.com/app_store_learnv2_aescreateappfromscratch_utah_secureappsanddata_images_servicenow_sec_useradminaccess.png">https://developer.servicenow.com/app_store_learnv2_aescreateappfromscratch_utah_secureappsanddata_images_servicenow_sec_useradminaccess.png</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6-hhWDzYy1BpY3yeqIih3w.png" /><figcaption>Source :<a href="https://www.basicoservicenowlearning.in/2020/01/types-of-servicenow-roles.html">https://www.basicoservicenowlearning.in/2020/01/types-of-servicenow-roles.html</a></figcaption></figure><h3><strong>Groups:</strong></h3><ul><li>Groups organize users into logical units to simplify user management and facilitate collaboration. They facilitate the assignment of tasks and permissions to multiple users simultaneously.<br>Example: Create an ‘IT Support’ group for assigning incident tasks to a team.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AKJmSC4Df4WJOg5J_YTUBg.png" /><figcaption>This Group has 2 group members</figcaption></figure><h3><strong>Workflows:</strong></h3><ul><li>Workflows automate and streamline processes by defining a series of sequential steps and approvals. They ensure tasks are completed in a predefined order and facilitate coordination between users.<br>Example: Implement an approval workflow for change requests to ensure proper authorization.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQq-as4tqVZ3sOLjTa0XXg.png" /><figcaption>Example of a Workflow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AqrbJ6Cv0mTEEcGZzTv21A.png" /><figcaption>Example of WorkFlow Stages</figcaption></figure><h3><strong>Notification:</strong></h3><ul><li>Notifications in ServiceNow inform users about important events, updates, or tasks assigned to them. They can be configured to trigger automatically based on predefined conditions or actions.<br> Example: Notify assigned technicians when a new incident is assigned to them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SrQtha3_3AGEd7WX7M2U8A.png" /></figure><h3><strong>Tables &amp; Fields:</strong></h3><ul><li>Tables and Fields define the structure and attributes of data stored in ServiceNow. Design and manage data structures, defining tables and fields to store and organize information.Tables represent entities, while fields define the characteristics and properties of those entities. Example: Create a ‘Customer Feedback’ table with fields for feedback type, description, and status.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EtfOXqG4T8SsXJd54QUQA.png" /><figcaption>Source :<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEYMY38mbYBfd0gajSacOgj-5DsOH8z8FaO2l8ZE8ao8R_DgL6Sb9XvTpjFvrml0bCtk12TcWpOk8Qze48Td7YmtGWyEtNPaIQ0bMzz_pGt8mjwyeLV_pi3Eskl6BZdF7m3ylF-RCyCHk/s1600/create+custom+table+in+servicenow.png">https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEYMY38mbYBfd0gajSacOgj-5DsOH8z8FaO2l8ZE8ao8R_DgL6Sb9XvTpjFvrml0bCtk12TcWpOk8Qze48Td7YmtGWyEtNPaIQ0bMzz_pGt8mjwyeLV_pi3Eskl6BZdF7m3ylF-RCyCHk/s1600/create+custom+table+in+servicenow.png</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPFZhv4hzOKw1FiAP06ZIA.png" /><figcaption>Source :<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ1AxUe-vLq7yjxpl0xfIGT-EC8VD4gntjdPu7NOs9o8bzJp4QHQyWTg-dMyDqjHF9bypgx8P8pi-5iIC2rAEF97vi6EgtHpnsUUx7YCuPoflMHTCUnEsYrYDrOfMm6GzJ75w43xe1uh8/s1600/columns+of+custom+table+in+servicenow.png">https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ1AxUe-vLq7yjxpl0xfIGT-EC8VD4gntjdPu7NOs9o8bzJp4QHQyWTg-dMyDqjHF9bypgx8P8pi-5iIC2rAEF97vi6EgtHpnsUUx7YCuPoflMHTCUnEsYrYDrOfMm6GzJ75w43xe1uh8/s1600/columns+of+custom+table+in+servicenow.png</a></figcaption></figure><h3><strong>Client Scripts:</strong></h3><p>Client scripts in ServiceNow are JavaScript scripts executed on the user’s browser, enabling dynamic behavior and user interaction within forms or UI pages.</p><p>Example: Create a client script to validate user input on a form field, such as ensuring a phone number is in the correct format, by attaching it to the ‘onSubmit’ event of the form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmYbptbIDdGl2dTwCTp-jA.png" /><figcaption>Source : <a href="https://www.basicoservicenowlearning.in/2019/12/client-side-scripting-in-servicenow.html">https://www.basicoservicenowlearning.in/2019/12/client-side-scripting-in-servicenow.html</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnxhpZ5gcbP3jbRtRGGAcQ.png" /><figcaption>Source : <a href="https://www.learnnowlab.com/Client-Script/">https://www.learnnowlab.com/Client-Script/</a></figcaption></figure><h3><strong>Script Includes:</strong></h3><p>Script Includes in ServiceNow are reusable scripts that encapsulate business logic and can be used both on the client-side and server-side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*taZKVD9glraS_Wa1ltcPcA.png" /><figcaption>Source : <a href="https://www.basicoservicenowlearning.in/2019/12/script-include-servicenow.html">https://www.basicoservicenowlearning.in/2019/12/script-include-servicenow.html</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9kn2qIDIbu3gElMsjLIfg.png" /><figcaption>Source : <a href="https://developer.servicenow.com/dev.do#!/learn/learning-plans/utah/new_to_servicenow/app_store_learnv2_scripting_utah_extend_a_script_include">https://developer.servicenow.com/dev.do#!/learn/learning-plans/utah/new_to_servicenow/app_store_learnv2_scripting_utah_extend_a_script_include</a></figcaption></figure><h3><strong>Import Data:</strong></h3><p>Data is not imported directly from a Data Source into the target table.Use Studio to create Data Sources. All other data import operations are done in the main ServiceNow browser window and are not captured as part of a scoped application.</p><p>The steps are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yjUQbNLXcZmTiAI86-8atw.png" /><figcaption>Source :<a href="https://servicenowmypath.blogspot.com/2017/10/">https://servicenowmypath.blogspot.com/2017/10/</a></figcaption></figure><p><strong>Note : Refer the below link for good documentation on Transform Map</strong><br><a href="https://developer.servicenow.com/dev.do?_escaped_fragment_=/learn/learning-plans/orlando/citizen_developer/app_store_learnv2_importingdata_orlando_create_a_transform_map">https://developer.servicenow.com/dev.do?_escaped_fragment_=/learn/learning-plans/orlando/citizen_developer/app_store_learnv2_importingdata_orlando_create_a_transform_map</a></p><h3><strong>Schedule Jobs :</strong></h3><p>Scheduling jobs in ServiceNow involves automating tasks to run at specified times.<br>For example, you might create a scheduled job named “Update Task Status” that runs daily at midnight to update task records based on certain conditions.<br>To create a scheduled job in ServiceNow:<br><strong>1.Navigate to Scheduled Jobs:</strong><br> Go to “Application Navigator/All”-&gt; “System Definition” -&gt; “Scheduled Jobs” in the application navigator.<br><strong>2. Create a New Scheduled Job:</strong><br> Click on “New” to create a new scheduled job record &amp; Select your choice.<br><strong>3.</strong> <strong>Define Job Details:</strong><br> Fill in details like name, description, and the script to be executed.<br><strong>4. Set Schedule:</strong><br> Specify the schedule for the job, such as daily, weekly, or monthly recurrence, along with the time and frequency.<br><strong>5. Save the Scheduled Job:</strong><br> Click on “Submit” to save the scheduled job.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vGZd7InRuyRU8UDgH5Rrjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDvoo4piSe2AOujXvILYxA.png" /><figcaption>Reference Image for Schedule Jobs</figcaption></figure><h3><strong>Reports:</strong></h3><ul><li>Reports in ServiceNow allow you to analyze and visualize data to gain insights into performance, trends, and patterns. They can be customized to meet specific requirements and shared with stakeholders.<br>Example: A report showing the number of incidents resolved by each technician over a specific period helps identify workload distribution and performance metrics.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cq1LF2TtWtWNMqV44ShLvQ.png" /><figcaption>Source :<a href="https://www.inry.com/hs-fs/hubfs/PMO-dashboard-Rome-1.jpg?width=1660&amp;name=PMO-dashboard-Rome-1.jpg">https://www.inry.com/hs-fs/hubfs/PMO-dashboard-Rome-1.jpg?width=1660&amp;name=PMO-dashboard-Rome-1.jpg</a></figcaption></figure><h3><strong>Rough Guide:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4p2xs0LXG_RNsexLWrvvmg.png" /><figcaption>Rough guide on how to choose for basic conditions</figcaption></figure><h3><a href="https://servicenowmypath.blogspot.com/2017/10/different-types-of-server-side-scripts.html">Different Types of Server Side Scripts and how they are triggered — ServiceNow</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eP9Xy-Bp-FY5aF-6PonPoA.png" /><figcaption>Source : <a href="https://servicenowmypath.blogspot.com/2017/10/">https://servicenowmypath.blogspot.com/2017/10/</a></figcaption></figure><p>Mastering these essential topics equips you with the tools needed to navigate ServiceNow confidently, empowering you to optimize workflows, enhance productivity, and propel your organization towards greater success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05c785ccc642" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub and Visual Studio Code: The Perfect Combination for Modern Development]]></title>
            <link>https://sushmithabhat95.medium.com/github-and-visual-studio-code-the-perfect-combination-for-modern-development-a3e0ad1ef018?source=rss-5614ab86ec17------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3e0ad1ef018</guid>
            <dc:creator><![CDATA[Sushmitha Bhat]]></dc:creator>
            <pubDate>Thu, 31 Aug 2023 14:37:27 GMT</pubDate>
            <atom:updated>2024-01-04T09:53:15.450Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone, let’s talk about Git and GitHub in a easy-to-understand way. Imagine you’re working on a coding project, and you want to keep track of all the changes you make to your code. That’s where <strong>Git </strong>comes in! So Git is <strong>offline </strong>way of keeping track of your code.</p><p><strong>GitHub </strong>is <strong>online </strong>way of keeping track of your work. GitHub is like the cool place where you can store and share your code with others. It’s like a big playground for developers around the world. You can think of it as a social network, but for coders!</p><p>When you use Git and GitHub together, it’s like having the best of both worlds. Git takes care of managing your code’s history and changes, while GitHub provides a platform to showcase and collaborate on your projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*axzO3VRdmfavIvd-.png" /><figcaption>Image source : <a href="https://devblogs.microsoft.com/visualstudio/wp-content/uploads/sites/4/2022/10/github-git-vs-workingtogether.png">https://devblogs.microsoft.com/visualstudio/wp-content/uploads/sites/4/2022/10/github-git-vs-workingtogether.png</a></figcaption></figure><h3>Setting Up a GitHub Account :</h3><p>To begin using GitHub, you need to create a GitHub account. Follow these steps to set up your account:</p><ol><li>Go to the GitHub website (<a href="https://github.com/"><strong>https://github.com</strong></a>) and click on “Sign Up.”</li><li>Fill in the required information, such as your username, email address, and password.</li><li>Choose a plan that suits your needs (you can start with the free plan).</li><li>Complete the setup process by verifying your email address.</li></ol><h3>Creating and Managing Repositories :</h3><p>Repositories in GitHub are like folders that contain all the files, history, and documentation for your projects.Here’s how you can create and manage repositories:</p><ol><li>Once logged in to GitHub, click on the “<strong>+</strong>” sign in the top-right corner and select “<strong>New repository</strong>.”</li><li>Provide a name for your repository and optionally add a description.</li><li>Choose whether you want the repository to be <strong>public </strong>or <strong>private</strong>.</li><li>Initialize the repository with a <strong>README file</strong> and other necessary files.(Optional)</li><li>Customize additional repository settings based on your requirements.</li></ol><h3>Collaborating with Others on GitHub :</h3><p>Now, the cool thing about GitHub is that it’s not just about storing your code. It’s designed to encourage collaboration. You can invite friends or fellow developers to work with you on your projects. It’s like having a coding hub where everyone can contribute their ideas and skills.</p><p>To invite a collaborator named “Sushmitha” to your repository, follow these steps below:</p><ol><li>Go to the repository’s “<strong>Settings</strong>” tab on GitHub.</li><li>Select “<strong>Manage Access</strong>” from the sidebar.</li><li>Click on the “<strong>Invite a collaborator</strong>” button.</li><li>Enter “Sushmitha” in the search field and select the right user.</li><li>Click on “<strong>Add [collaborator] to this repository</strong>” to invite them as a collaborator.</li><li>Issues and Discussions: Use the “<strong>Issues</strong>” tab to track and manage tasks, bug reports, or feature requests. Encourage discussions and feedback from collaborators through the “<strong>Discussions</strong>” tab.</li><li>Forking and Pull Requests: Collaborators can <strong>fork </strong>your repository to create their copy. They can then make changes, commit them to their forked repository, and submit a <strong>pull request</strong> to propose merging their changes into the original repository.</li></ol><h3>Integrating GitHub with Visual Studio Code :</h3><p>Integrating GitHub with Visual Studio Code enhances your development workflow. Here’s how to set it up:</p><ol><li>Install Visual Studio Code: If you haven’t already, download and install Visual Studio Code from the official website (<a href="https://code.visualstudio.com/">https://code.visualstudio.com</a>) for your operating system.</li><li>Install the Git SCM: Download the Git Bash setup from the official website: (<a href="https://git-scm.com/">https://git-scm.com</a>).Run the Installer with default options. Configure Git.Restart PC. Verify the Installation in Visual Studio Code by going to View -&gt; Terminal(Inside terminal click on Downward arrow near “+” symbol, <strong>select default profile</strong> as “Git Bash”), run the following command to verify that Git is installed:</li></ol><pre>git --version</pre><p>Once the above command give Git Version, run the following commands to configure your Git identity:</p><pre>git config --global user.name &quot;Your Name&quot;<br>git config --global user.email &quot;your-email@example.com&quot;</pre><h3>Cloning a repository :</h3><p>Cloning in Git allows you to create a local copy of a remote repository. It’s a basic command used to start working with a Git repository on your local machine.</p><p>To clone a repository using git clone, follow the steps below:</p><ol><li><strong>Find the Repository URL</strong>: Go to the repository you want to clone on GitHub page, click on “&lt;&gt; Code”, click on “HTTPS”, locate the repository’s URL and copy it.</li><li><strong>Open a Terminal and Navigate to the Directory</strong>:</li></ol><p>Here are some basic Linux commands that you might commonly use along with Git commands:</p><pre>/* Note: directory is folder here */<br>/* ls: List files and directories in the current directory */<br>ls<br>/* cd: Change directory. Use this command to navigate between directories */<br>cd directory_name<br>/* pwd: Print the current working directory. It shows you the path of the directory you are currently in */<br>pwd<br>/* mkdir: Create a new directory */<br>mkdir directory_name</pre><p><strong>Clone the Repository</strong>: In the terminal, run the <strong>git clone</strong> command followed by the repository URL. It looks like this:</p><pre>git clone &lt;repository_url_copied_from_GitHub_page&gt;<br>/* Looks like below */<br>git clone https://github.com/sample/sampleRepo.git</pre><h3>Branching:</h3><p>Imagine you’re working on a project, and you want to try out a new feature or experiment with some changes without affecting the main project. Branching in Git allows you to create a separate “copy” of your codebase where you can work on these changes independently.</p><pre>/* create a branch called &quot;new_branch_name&quot; */<br>git checkout -b new_branch_name</pre><h3>Check Repository Status :</h3><p>let’s say you’ve made some changes to the files. This command will display the current status of the repository, showing any modified, deleted, or untracked files.</p><pre>git status</pre><h3>Stash Your Changes :</h3><p>Imagine you are working on a new branch in a Git repository. Suddenly, you realize that you need to update your branch with the latest changes from the main branch.However, you also have some unfinished changes on your local branch that you don’t want to commit yet.</p><p>When you run git stash, it&#39;s like putting your current changes aside ( temporarily storing) for a moment. This allows you to return to a clean state without committing the changes.</p><pre>/* Command to temporarily Stash the changes */<br>git stash</pre><h3>Pull Changes from Main:</h3><p>When you run git pull, it&#39;s like fetching the latest changes from the remote repository and automatically merging them into your current branch.</p><pre>/* To fetch and merge the latest changes from the remote &quot;main&quot; branch to main branch */<br>git pull<br><br>/* To fetch and merge the latest changes from the remote &quot;main&quot; branch into your feature branch */<br>git pull origin main</pre><h3>Apply Your Stash:</h3><p>After the git pull, run git stash apply to get back your saved changes from the temporarily stored/ stashed data and reapply them to your updated branch. Now you have added you code on top of the newly pulled Code.If you face any conflicts resolve and proceed.</p><pre>/*run below command to retrieve your saved/Stashed changes */<br>git stash apply</pre><h3>Add Your Changes :</h3><p>Git doesn’t automatically keep track of all your changes. You need to tell Git which changes you want to include in the next commit, this command adds all the modified and new files to the staging area.(Staging area is a place where you gather all the changes you want to include in your commit.)</p><pre>/* Add All Changes use &#39;.&#39; */<br>git add .<br><br>/* Add changes made to a file named &#39;index.html&#39; */<br>git add index.html</pre><h3>Commit Your Changes :</h3><p>When you run the command “git commit,” you are telling Git to save the changes you’ve made since the last commit. These changes can be new code you’ve written, modifications to existing code, or even deleted files. “<strong>git commit</strong>” is like saving a snapshot of your code changes with a descriptive message.</p><pre>/*Replace &quot;Your commit message&quot; with a brief and descriptive message that explains the changes you made*/<br>git commit -m &quot;Your commit message&quot;</pre><h3>Push Your Changes :</h3><p>When you run “<strong>git push</strong>,” you are essentially telling Git to upload your committed changes to the remote server. It’s like sending your saved snapshots to the cloud, making them accessible to you and your collaborators from anywhere in the world.</p><pre>/*The correct syntax is git push to main branch*/<br>git push<br>/*The correct syntax is git push &lt;remote_name&gt; &lt;branch_name&gt;. The remote_name is typically &quot;origin,&quot; which is the default name for the remote repository you cloned from. And the branch_name is the name of the branch you want to push.*/<br>git remote add origin https://github.com/gitName/repoName.git<br>git push origin branch_name</pre><p><strong>For authentication do follow below steps :</strong></p><p>If you are pushing for the first time, this will open a browser window asking you to sign in to your GitHub account.After signing in, GitHub will prompt you to authorize Visual Studio Code’s access to your GitHub account. Click on the “Authorize” button to grant the necessary permissions.</p><h3>Merging:</h3><p>Once you’ve finished working on your new baranch, it’s time to bring those changes back into the main branch.Any changes you make in new branch won’t impact the main, until you decide to merge them.</p><pre>/* you need to switch back to the main branch (usually called &quot;master&quot; or &quot;main&quot;)*/<br>git checkout master<br>/* you&#39;ll merge the &quot;new_branch_name&quot; into the main branch */<br>git merge new_branch_name</pre><h3>Resolving Conflicts:</h3><p>Few times while working with few collaborators, when you try to merge your branch to main branch, Git may encounter conflicting changes. This happens when both branches have made different modifications to the same part/line of the code.</p><p>To resolve conflicts, you’ll <strong>open the files with conflicts and manually choose which changes to keep or both</strong>.</p><pre>/*After Resolving the Merge onflicts*/<br>git add .<br>git commit -m &quot;Resolving merge conflicts of new_branch_name into master&quot;</pre><h3>Pull request/Merge request:</h3><p>Many times you don’t have direct access to merge changes into the main branch, you can still contribute your changes by creating a “pull request” or “merge request” to request that your changes be merged into the main branch.</p><pre>1. <strong>Go to the Repository</strong>: Navigate to the repository on the GitHub, where the remote repository is hosted.<br><br>2. <strong>Create a Pull Request</strong>: Look for a &quot;Pull Request&quot; or &quot;New Merge Request&quot; button or tab. Click on it to create a new pull request.<br><br>3. <strong>Select the Branches</strong>: In the pull request creation form, select the source branch (the new branch with your changes) and the target branch (like main branch ) where you want your changes to be merged.<br><br>4. <strong>Describe Your Changes</strong>: Give a clear and brief title and description for your pull request. Explain what changes you&#39;ve made, why they are valuable etc... for the reviewer to understand your work.<br><br>5. <strong>Submit the Pull Request</strong>: Once you&#39;re done with the description and changes, submit the pull request. It will be sent to the repository&#39;s maintainers or collaborators for review.<br><br>6. <strong>Get Review and Feedback</strong>: The repository maintainers or collaborators will review your changes and provide feedback. They may ask for additional changes or clarification before approving the pull request.<br><br>7. <strong>Merge the Pull Request</strong>: If your changes are approved, one of the maintainers will merge your pull request into the main branch, making your changes a part of the project.</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPL6MSyYU4seF8OUxDDlgksg47meUFcOPJ3&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fplaylist%3Flist%3DPL6MSyYU4seF8OUxDDlgksg47meUFcOPJ3&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmhiIv42ppvM%2Fhqdefault.jpg%3Fsqp%3D-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ%3D%3D%26rs%3DAOn4CLAqujMV7Bt2sSoiBCrRqbHlfDMtoA%26days_since_epoch%3D19601&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="853" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/372766282101240a2328514df229ec81/href">https://medium.com/media/372766282101240a2328514df229ec81/href</a></iframe><p>Experience a visual walkthrough of the concepts discussed in this article! In this engaging YouTube Playlist, I have covered the key points, provided real-world examples, and guide you through the practical implementation steps. Whether you’re a visual learner or looking to reinforce your understanding, this video complements the written content and brings the concepts to life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3e0ad1ef018" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>