<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>post ServiceNow GlideRecord Mark Read-Only | ServiceNow GlideRecord Tips and Tricks in Developer articles</title>
    <link>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/ta-p/2362775</link>
    <description>&lt;DIV class="lia-message-template-content-zone"&gt;
&lt;P&gt;Hi All,&lt;BR /&gt;I hope you are doing fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;As a ServiceNow developer, the thing which you will encounter daily is GlideRecord API. Whenever we have to retrieve any information from the database the GlideRecord is the primary API.&lt;/LI&gt;
&lt;LI&gt;Let's first try to understand what is GlideRecord in ServiceNow.&lt;/LI&gt;
&lt;LI&gt;As per ServiceNow docs, the ServiceNow GlideRecord class is the way to interact with the ServiceNow database from a script. See the GlideRecord API reference for a complete list of methods.&lt;BR /&gt;GlideRecord interactions start with a database query.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;The generalized strategy is:&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL&gt;
&lt;LI&gt;Create a GlideRecord object for the table of interest.&lt;/LI&gt;
&lt;LI&gt;Build the query condition(s).&lt;/LI&gt;
&lt;LI&gt;Execute the query.&lt;/LI&gt;
&lt;LI&gt;Apply script logic to the records returned in the GlideRecord object.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In my project, I have faced a scenario where we have created a function that returns a GlideRecord object as an output, and our intention is just to provide read access to the object via GlideRecord.&lt;/LI&gt;
&lt;LI&gt;But in most cases, people will start modifying that object by updating a specific attribute on that record which in return changes the base values for the record.&lt;/LI&gt;
&lt;LI&gt;We were looking at the feasibility to make this GlideRecord restricted from the update that's where I encountered this hidden concept.&lt;BR /&gt;In this tutorial, we will be looking at the way to make GlideRecord Read-only so that no one can update the returned GlideRecord. Isn't it amazing?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Agenda:&lt;/STRONG&gt;
&lt;UL&gt;
&lt;LI&gt;What is GlideRecord&lt;/LI&gt;
&lt;LI&gt;Problem statement for the exposure of GlideRecord Object&lt;/LI&gt;
&lt;LI&gt;How we can mark the gLideRecord to ReadOnly&lt;/LI&gt;
&lt;LI&gt;Function to check if the GlideRecord is ReadOnly&lt;/LI&gt;
&lt;LI&gt;Demo&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FokAJPNl4QEA%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DokAJPNl4QEA&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FokAJPNl4QEA%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="600" height="337" scrolling="no" title="ServiceNow GlideRecord Mark Read-Only | ServiceNow GlideRecord Tips and Tricks | ServiceNow" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If you like this video please subscribe to my channel Technomonk for more such videos in the future.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Amit Gujarathi&lt;/P&gt;
&lt;P&gt;(Technomonk)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Technomonk Youtube:&amp;nbsp;&lt;A href="https://www.youtube.com/c/TechnoMonkAmit" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.youtube.com/c/TechnoMonkAmit&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Amit Gujarathi Linkedin:&amp;nbsp;&lt;A href="https://www.linkedin.com/in/amit-gujarathi-98632a175" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.linkedin.com/in/amit-gujarathi-98632a175&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thetechnomonk.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;TheTechnomonk.com&lt;/A&gt;&amp;nbsp;:&amp;nbsp;&lt;A href="https://thetechnomonk.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://thetechnomonk.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;ServiceNow Community Amit Gujarathi:&amp;nbsp;&lt;A href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265565" target="_blank" rel="noopener"&gt;https://www.servicenow.com/community/user/viewprofilepage/user-id/265565&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;GitHub:&amp;nbsp;&lt;A href="https://github.com/amigujarathi" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/amigujarathi&lt;/A&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 31 Oct 2022 12:09:23 GMT</pubDate>
    <dc:creator>Amit Gujarathi</dc:creator>
    <dc:date>2022-10-31T12:09:23Z</dc:date>
    <item>
      <title>ServiceNow GlideRecord Mark Read-Only | ServiceNow GlideRecord Tips and Tricks</title>
      <link>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/ta-p/2362775</link>
      <description>&lt;H1 class="style-scope ytd-watch-metadata"&gt;&lt;STRONG&gt;ServiceNow GlideRecord Mark Read-Only | ServiceNow GlideRecord Tips and Tricks&lt;/STRONG&gt;&lt;/H1&gt;</description>
      <pubDate>Mon, 31 Oct 2022 12:09:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/ta-p/2362775</guid>
      <dc:creator>Amit Gujarathi</dc:creator>
      <dc:date>2022-10-31T12:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: ServiceNow GlideRecord Mark Read-Only | ServiceNow GlideRecord Tips and Tricks</title>
      <link>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/tac-p/2367586#M6534</link>
      <description>&lt;P&gt;This is interesting, thanks for sharing&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265565"&gt;@Amit Gujarathi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have mostly used GlideRecord objects to update the value in the record . If possible can you share a business case where just we don't want to update record and just want the record value..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Moreover, thanks again.&lt;/P&gt;&lt;P&gt;Happy to learn something new !&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 15:13:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/tac-p/2367586#M6534</guid>
      <dc:creator>Manal  AQUIL</dc:creator>
      <dc:date>2022-10-31T15:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: ServiceNow GlideRecord Mark Read-Only | ServiceNow GlideRecord Tips and Tricks</title>
      <link>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/tac-p/2367634#M6535</link>
      <description>&lt;P&gt;Hi Manal,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are couple of use case which I can think of wherever we want to restrict it the Glide Record object.&lt;/P&gt;
&lt;P&gt;Lets consider a simple scenario where I have custom table which holds the configurations and script which is required in order to drive certain logic in my scripted rest API.&lt;/P&gt;
&lt;P&gt;So I have created a function which will expose the Glide record for configuration which then can be used to drive further logic based on the Glide Record information.&lt;/P&gt;
&lt;P&gt;Now this Glide&amp;nbsp; Record is vulnerable to the updates if any one updates the configuration by mistake.&lt;/P&gt;
&lt;P&gt;So I will make the Glide Record read only so that they can access the information to drive the process but cannot update the base configuration which makes it error prone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it answers your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Amit Gujarathi&lt;/P&gt;
&lt;P&gt;(Technomonk)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Technomonk Youtube:&amp;nbsp;&lt;A href="https://www.youtube.com/c/TechnoMonkAmit" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.youtube.com/c/TechnoMonkAmit&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Amit Gujarathi Linkedin:&amp;nbsp;&lt;A href="https://www.linkedin.com/in/amit-gujarathi-98632a175" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.linkedin.com/in/amit-gujarathi-98632a175&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thetechnomonk.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;TheTechnomonk.com&lt;/A&gt;&amp;nbsp;:&amp;nbsp;&lt;A href="https://thetechnomonk.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://thetechnomonk.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;ServiceNow Community Amit Gujarathi:&amp;nbsp;&lt;A href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265565" target="_blank" rel="noopener"&gt;https://www.servicenow.com/community/user/viewprofilepage/user-id/265565&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;GitHub:&amp;nbsp;&lt;A href="https://github.com/amigujarathi" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/amigujarathi&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 14:02:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/servicenow-gliderecord-mark-read-only-servicenow-gliderecord/tac-p/2367634#M6535</guid>
      <dc:creator>Amit Gujarathi</dc:creator>
      <dc:date>2022-10-31T14:02:35Z</dc:date>
    </item>
  </channel>
</rss>

