www.servicenow.com Open in urlscan Pro
23.45.105.152  Public Scan

Submitted URL: https://www.servicenow.com/community/developer-forum/how-do-i-set-the-default-time-value-when-i-click-the-new-button/m-p/31...
Effective URL: https://www.servicenow.com/community/developer-forum/how-do-i-set-the-default-time-value-when-i-click-the-new-button/m-p/31...
Submission: On November 12 via api from RU — Scanned from DE

Form analysis 1 forms found in the DOM

Name: formPOST https://www.servicenow.com/community/forums/v5/forumtopicpage.searchformv32.form.form

<form enctype="multipart/form-data" class="lia-form lia-form-inline SearchForm" action="https://www.servicenow.com/community/forums/v5/forumtopicpage.searchformv32.form.form" method="post" id="form" name="form">
  <div class="t-invisible"><input value="board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw" name="t:ac" type="hidden"><input
      value="search/contributions/page" name="t:cp" type="hidden"><input
      value="Made-TBV3AnHtzifRa2wukePEM29pb7RX69yykZ-iHDZTvkZyBhNSQmEUbzAa3pCFgnjGw1Ow69zmc67_eGgfncQUs8vPaLqYftEa27JO7PbTaxT-b5KHzar3K-kQpzz4as26nNzGzwWh3PQb-vHiLfDm5QdVSEFzDD1I_z20IHcFOkMmon9PkfacT0DmCW-zttv8GpI9lp0tT6VO5tnCMonxZJjucqyxd5vVLjRL3ehGSmr4xY4QF5DVP6jiQXm9bWpRoFULsTICBjQqZPvn70kxE5nX3SKwHLaHH63CdO-pfpCa_9Bzl2TqrOYrsx3_r18LGsEQIiUUqUpiYYLEVC-Y29ZCUJA4H-FjlPGt3zJ-j2DvNH5geQQxxcvRlsag_Zr-NQYUj1JBmoIl3EtzlbDVmrv6XFuKz6kzVLcz3Cd_LUJ10mx26DMnN-NNsAQneAKcd5PkiuahDz8bb5lHEVMg0sWB54u0SokPm-EudahknS8wbpXfk3h-IVPh_SA_W2RlDBS_A9r7zRRo_sard6DE_QpPy57zbxhm3LsHiLpy1f2j41osR1RtmxqTOHYPc6JmUK774-P2NmzogmoPqPNyFD67FiqlTjqEwv_S74SDM2_LQ2l5AIj7q_x_kyT45SQusFC0QOj2Fi6gvCTpj_qwEj_6xlS72cWKRwdUZg2EiHCdFpN0QtHwSSo9jXm21CkZOpgbxd3-kgt1jpIHQpqTH30X7PcErVYEPIR9UKIMWnGylu-4ltOMwpCRSl_F3WgZdBGVhHBLZdnnufZDfzCosp7c4z3eHYnp1CSX1lPDDz6bZ-anoqpV415FRu4AyWZjGob4Ky8ZA412D7NMmfc40_87luD4kfyYs5vL8o0lWo5yj6Dp--xmfjy3DDYOsVlu7uNGVimkn7L1If0G7te26r-J_TVaBC0mQFSNj_Tx4bGi2dR4rV_Lq1-WMcENwLOvjfi1uC_JT8JVZC7_5_gXIreW3UJUCiOCLyeE21GX9mhZX123H9YAUzi10Iv9eC3mO_lINJxllKFKkycEXaG8AFlkFBrPjXNlKt0PItgxNuO6CZeEszTHAskGGhcYzsb8VZ1Azri1vKeKcYwBmI0bqFab_JQO5CVvCbhYiwFatEkCZ8LIdPSlbKRpLf_58h2b9M4RtDde8InquKiszCGmf_3N_Oi7KmYopXuyEhKu-fqAT4TAx1NgfUirlFqzkcRun35w2anyqHoVpF5swxNmKdilMn1zBnqcATafqw."
      name="lia-form-context" type="hidden"><input
      value="ForumTopicPage:board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw:searchformv32.form:" name="liaFormContentKey"
      type="hidden"><input
      value="5DI9GWMef1Esyz275vuiiOExwpQ=:H4sIAAAAAAAAALVSTU7CQBR+krAixkj0BrptjcpCMSbERGKCSmxcm+kwlGrbqTOvFDYexRMYL8HCnXfwAG5dubDtFKxgYgu4mrzvm3w/M+/pHcphHQ4kI4L2dMo9FLYZoM09qbeJxQ4V0+XC7e/tamqyBPEChwgbh1JAjQtLIz6hPaYh8ZlEMaxplAvm2KZmEsm0hhmBhOKpzZzOlsEw8LevR5W3zZfPEqy0oJIYc+eCuAyh2rolfaI7xLN0I8rjWfWBj7CuzJvf5osmbxRN3hacMimNwHRtKSOr0XNnv/vx+FoCGPjhMRzljhNLYHrEt9kA5T08ACCsKvREoYuqxqLl8BLO84q4UcMITcG49y/QOGs1pYyESl5p6V6qwRW086rinVmoxMZsiZud/zBUTc6gmVc4kExkJafmcYG1GM9+wfIsCkf2OP54hal5EjnG54z8h0XhjfcF7wQUs5Kz0GTjU2rOjc/llTT4Au07pDOcBQAA"
      name="t:formdata" type="hidden"></div>
  <div class="lia-inline-ajax-feedback">
    <div class="AjaxFeedback" id="feedback"></div>
  </div>
  <input value="jW_hYSRIJrTep9RaIy0R1OIiFN1vVT0735GSYm6XWI0." name="lia-action-token" type="hidden">
  <input value="form" id="form_UIDform" name="form_UID" type="hidden">
  <input value="" id="form_instance_keyform" name="form_instance_key" type="hidden">
  <span class="lia-search-granularity-wrapper">
    <select title="Search Granularity" class="lia-search-form-granularity search-granularity" aria-label="Search Granularity" id="searchGranularity" name="searchGranularity">
      <option title="All community" value="cgfwn76974|community">All community</option>
      <option title="This category" value="Developer|category" style="display: none;">This category</option>
      <option title="This forum" selected="selected" value="developer-forum|forum-board">This forum</option>
      <option title="Articles" value="tkb|tkb" style="display: none;">Articles</option>
      <option title="Users" value="user|user" style="display: none;">Users</option>
      <option title="Products" value="product|product" style="display: none;">Products</option>
    </select>
  </span>
  <span class="lia-search-input-wrapper">
    <span class="lia-search-input-field">
      <span class="lia-button-wrapper lia-button-wrapper-secondary lia-button-wrapper-searchForm-action"><input value="searchForm" name="submitContextX" type="hidden"><input class="lia-button lia-button-secondary lia-button-searchForm-action"
          value="Search" id="submitContext" name="submitContext" type="submit"></span>
      <span class="lia-hidden-aria-visibile" id="autocompleteInstructionsText" role="alert"></span><input placeholder="Search in this forum" aria-label="Search" title="Search"
        class="lia-form-type-text lia-autocomplete-input search-input lia-search-input-message" value="" id="messageSearchField_0" name="messageSearchField" type="text" aria-autocomplete="both" autocomplete="off">
      <div class="lia-autocomplete-container" style="display: none; position: absolute;">
        <div class="lia-autocomplete-header">Enter a search word</div>
        <div class="lia-autocomplete-content">
          <ul></ul>
        </div>
        <div class="lia-autocomplete-footer">
          <a class="lia-link-navigation lia-autocomplete-toggle-off lia-link-ticket-post-action lia-component-search-action-disable-auto-complete" data-lia-action-token="7TQywztUYim1sgpJ5qR-WO0XEKYOIrHUP5XlYUu8-Fo." rel="nofollow" id="disableAutoComplete_16c3c7bed77d68" href="https://www.servicenow.com/community/forums/v5/forumtopicpage.disableautocomplete:disableautocomplete?t:ac=board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw&amp;t:cp=action/contributions/searchactions">Turn off suggestions</a>
        </div>
      </div>
      <span class="lia-hidden-aria-visibile" id="autocompleteInstructionsText_0" role="alert"></span><input placeholder="Search in this forum" aria-label="Search" title="Search"
        class="lia-form-type-text lia-autocomplete-input search-input lia-search-input-tkb-article lia-js-hidden" value="" id="messageSearchField_1" name="messageSearchField_0" type="text" aria-autocomplete="both" autocomplete="off">
      <div class="lia-autocomplete-container" style="display: none; position: absolute;">
        <div class="lia-autocomplete-header">Enter a search word</div>
        <div class="lia-autocomplete-content">
          <ul></ul>
        </div>
        <div class="lia-autocomplete-footer">
          <a class="lia-link-navigation lia-autocomplete-toggle-off lia-link-ticket-post-action lia-component-search-action-disable-auto-complete" data-lia-action-token="LwvuURKFSZ3aNfocgJY3w8d1juw0BALQ-DCpQgaqGgY." rel="nofollow" id="disableAutoComplete_16c3c7bf28aa4d" href="https://www.servicenow.com/community/forums/v5/forumtopicpage.disableautocomplete:disableautocomplete?t:ac=board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw&amp;t:cp=action/contributions/searchactions">Turn off suggestions</a>
        </div>
      </div>
      <span class="lia-hidden-aria-visibile" id="autocompleteInstructionsText_1" role="alert"></span><input placeholder="Enter a keyword to search within the users" ng-non-bindable="" title="Enter a user name or rank"
        class="lia-form-type-text UserSearchField lia-search-input-user search-input lia-js-hidden lia-autocomplete-input" aria-label="Enter a user name or rank" value="" id="userSearchField" name="userSearchField" type="text"
        aria-autocomplete="both" autocomplete="off">
      <div class="lia-autocomplete-container" style="display: none; position: absolute;">
        <div class="lia-autocomplete-header">Enter a user name or rank</div>
        <div class="lia-autocomplete-content">
          <ul></ul>
        </div>
        <div class="lia-autocomplete-footer">
          <a class="lia-link-navigation lia-autocomplete-toggle-off lia-link-ticket-post-action lia-component-search-action-disable-auto-complete" data-lia-action-token="56SnZpzq-DV-oFk-ck6FaOKuTkMMjGH8M1I14rPeixQ." rel="nofollow" id="disableAutoComplete_16c3c7bf477276" href="https://www.servicenow.com/community/forums/v5/forumtopicpage.disableautocomplete:disableautocomplete?t:ac=board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw&amp;t:cp=action/contributions/searchactions">Turn off suggestions</a>
        </div>
      </div>
      <span class="lia-hidden-aria-visibile" id="autocompleteInstructionsText_2" role="alert"></span><input placeholder="Enter a keyword to search within the private messages" title="Enter a search word"
        class="lia-form-type-text NoteSearchField lia-search-input-note search-input lia-js-hidden lia-autocomplete-input" aria-label="Enter a search word" value="" id="noteSearchField_0" name="noteSearchField" type="text" aria-autocomplete="both"
        autocomplete="off">
      <div class="lia-autocomplete-container" style="display: none; position: absolute;">
        <div class="lia-autocomplete-header">Enter a search word</div>
        <div class="lia-autocomplete-content">
          <ul></ul>
        </div>
        <div class="lia-autocomplete-footer">
          <a class="lia-link-navigation lia-autocomplete-toggle-off lia-link-ticket-post-action lia-component-search-action-disable-auto-complete" data-lia-action-token="sZadQkuZBc7YEdSkSpCaZ_phXoC9leYJuOVSlo27rzY." rel="nofollow" id="disableAutoComplete_16c3c7bf65b506" href="https://www.servicenow.com/community/forums/v5/forumtopicpage.disableautocomplete:disableautocomplete?t:ac=board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw&amp;t:cp=action/contributions/searchactions">Turn off suggestions</a>
        </div>
      </div>
      <span class="lia-hidden-aria-visibile" id="autocompleteInstructionsText_3" role="alert"></span><input title="Enter a search word"
        class="lia-form-type-text ProductSearchField lia-search-input-product search-input lia-js-hidden lia-autocomplete-input" aria-label="Enter a search word" value="" id="productSearchField" name="productSearchField" type="text"
        aria-autocomplete="both" autocomplete="off">
      <div class="lia-autocomplete-container" style="display: none; position: absolute;">
        <div class="lia-autocomplete-header">Enter a search word</div>
        <div class="lia-autocomplete-content">
          <ul></ul>
        </div>
        <div class="lia-autocomplete-footer">
          <a class="lia-link-navigation lia-autocomplete-toggle-off lia-link-ticket-post-action lia-component-search-action-disable-auto-complete" data-lia-action-token="r3KktlRu22pI2De4JK79xxyveo_ypTSI37JLmz_fGLs." rel="nofollow" id="disableAutoComplete_16c3c7bf831524" href="https://www.servicenow.com/community/forums/v5/forumtopicpage.disableautocomplete:disableautocomplete?t:ac=board-id/developer-forum/message-id/1158711/thread-id/1158711/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufE0zRFhJRzM0NUVPQVRQfDMxMDE5MDV8U1VCU0NSSVBUSU9OU3xoSw&amp;t:cp=action/contributions/searchactions">Turn off suggestions</a>
        </div>
      </div>
      <input class="lia-as-search-action-id" name="as-search-action-id" type="hidden">
    </span>
  </span>
  <span class="lia-cancel-search">cancel</span>
</form>

Text Content

See demos and learn more about the Xanadu release, our biggest AI release yet.




SERVICENOW COMMUNITY SERVICENOW COMMUNITY

Help
 * English (US)
 * English (UK)
 * German
 * Spanish
 * French
 * Italian
 * Japanese
 * Korean
 * Dutch
 * Portuguese (Brazilian)

 * Developer Build, test, and deploy applications on the Now Platform.
 * ServiceNow Learn more about ServiceNow products and solutions.
 * Learning Build your skills with instructor-led and online training.
 * Support Manage your instances, access self-help, and get technical support.

 * Documentation Find detailed info about ServiceNow products, apps, features,
   and releases.
 * Impact Drive a faster ROI and amplify your expertise with ServiceNow Impact.
 * Partner Grow your business with promotions, news, and marketing tools for
   partners.
 * Store Download certified apps and integrations that complement ServiceNow.


Join the Community
Browse

   
 * Product Hubs
      
    * Releases and Upgrades
      
      
    * App Development
         
       * Getting Started with App Development
         
       * App Engine Studio
         
       * Citizen Development Center
         
       * Creator Studio
         
       * Now Assist for Creator
         
       * ServiceNow Studio
   
      
      
      
      
    * Asset Management
         
       * Cloud Cost Management
         
       * Enterprise Asset Management
         
       * Hardware Asset Management
         
       * Software Asset Management
   
      
      
    * Customer Service Management
      
      
      
    * Data foundations
         
       * API Insights
         
       * CMDB
         
       * CSDM
   
      
      
    * Employee Center
      
    * Governance, Risk, & Compliance
      
    * Human Resources Service Delivery
      
    * ServiceNow Impact
      
    * Industry solutions
         
       * Financial Services Operations
         
       * Healthcare and Life Sciences
         
       * Manufacturing
         
       * Public Sector Digital Services
         
       * Retail & Hospitality
         
       * Technology Provider
         
       * Telecommunications
         
   
      
      
    * IT Operations Management
      
    * IT Service Management
      
    * Now Assist & Generative AI
      
    * Now Platform
         
       * Admin Experience
         
       * Agent Chat, Routing, and Sidebar
         
       * Intelligence & Machine Learning
         
       * Knowledge Management
         
       * Mobile Apps & Platform
         
       * Next Experience
         
       * Platform Analytics
         
       * Platform Privacy & Security
         
       * Service Portal
         
       * Virtual Agent & NLU
         
       * Workflow Automation
         
   
      
      
    * Security Operations
      
    * Strategic Portfolio Management
      
      
    * More ServiceNow Products
         
       * Application Portfolio Management
         
       * Automation Engine
       * Cloud Observability
         
       * Collaborative Work Management
         
       * DevOps Change Velocity
         
       * Digital End-user Experience
         
       * Digital Portfolio Management
         
       * Digital Product Release
         
       * Environmental, Social, and Governance
         
       * Field Service Management
         
       * Health and Safety
         
       * Internationalization & Localization
         
       * Legal Service Delivery
         
       * Process Mining
         
       * Operational Technology
       * Sales and Order Management
       * Service Operations Workspace
         
       * ServiceNow for MS Teams
         
       * Source-to-Pay Operations
         
       * Talent Development
         
       * Workplace Service Delivery
   
      
      

   
 * Discussions
      
    * Architects
      
    * Champion Community
      
    * Developers
      
    * Expert Services
      
    * Knowledge Managers
      
    * New Customer Onboarding
      
    * Platform Owner Resource Center
      
    * SysAdmins
      
    * ServiceNow Jobs
      
    * Training and Certifications
      

   
 * Blogs
      
    * Community Blogs
    * Developer Advocate Blog
      
    * Developer Blog
      
    * ServiceNow Blogs
      
    * Japan
      

   
 * Groups
      
    * Connected in Tech Groups
      
      
    * ServiceNow User Groups (SNUGs)
      
    * Special Interest Groups (SIGs)
         
       * Energy
         
       * Financial Services
         
       * Governments & Military
         
       * Healthcare
         
       * Higher Education
         
       * Life Sciences
         
       * Manufacturing
         
       * User Experience
         
       * All Special Interest Groups

   
 * Events
      
    * Community Events
      
    * Live on ServiceNow
      
    * AI Pacesetter Awards
      
    * CreatorCon 2024
      
    * The Devvies: App of the Year
      
    * DemoCenter
      
    * Partner Events
      
    * ServiceNow Podcasts
      
    * ServiceNow Events
      

   
 * Resources
      
    * Community Central
      
    * Community Guidelines
      
    * Recognition & Rewards Program
      
    * Leaderboards
      
      
    * Become an Expert
         
       * ServiceNow MVP Program
         
       * Rising Star Program
   
      
      
      
    * Idea Portal

   
   
 * RiseUp with ServiceNow
      
    * RiseUp with ServiceNow Forum
    * RiseUp with ServiceNow Events
    * RiseUp with ServiceNow Blogs
      
      
      
      
      

Join the Community


All communityThis categoryThis forumArticlesUsersProducts
Enter a search word

Turn off suggestions
Enter a search word

Turn off suggestions
Enter a user name or rank

Turn off suggestions
Enter a search word

Turn off suggestions
Enter a search word

Turn off suggestions
cancel
Turn on suggestions
Showing results for 
Show  only  | Search instead for 
Did you mean: 
 * ServiceNow Community
 * 
 * Discussions
 * 
 * Developer
 * 
 * Developer forum
 * 
 * How do I set the default time value when I click t...

Options
 * Subscribe to RSS Feed
 * 
 * Mark Question as New
 * Mark Question as Read
 * 
 * Float this Question for Current User
 * Bookmark
 * Subscribe
 * Mute
 * 
 * Printer Friendly Page


HOW DO I SET THE DEFAULT TIME VALUE WHEN I CLICK THE NEW BUTTON?

Go to solution
shiz
Tera Contributor

Options
 * Mark as New
 * Bookmark
 * Subscribe
 * Mute
 * 
 * Subscribe to RSS Feed
 * 
 * Permalink
 * Print
 * 
 * Report Inappropriate Content

4 hours ago

I created a screen



 

When I click on ‘New’ button than 'Week Start On' be set to the current Manday
date.



How should this be implemented specifically?

 

Solved! Go to Solution.



0 Helpfuls

 * 57 Views

Reply



1 ACCEPTED SOLUTION

Go to solution
Pradeep Thipani
Kilo Sage

Options
 * Mark as New
 * Bookmark
 * Subscribe
 * Mute
 * 
 * Subscribe to RSS Feed
 * 
 * Permalink
 * Print
 * 
 * Report Inappropriate Content

4 hours ago

Hi Shiz,

 

You can achieve that by writing an OnLoad client script for the respective table
you are referring.

 

Here is a sample code you can refer:

function onLoad() {
    if (g_form.isNewRecord()) {
        var today = new Date();
        var day = today.getDay();
        // Calculate the Monday of the current week
        var monday = new Date(today.setDate(today.getDate() - (day === 0 ? 6 : day - 1)));
        g_form.setValue('week_start_on', monday.toISOString().split('T')[0]);
    }
}

 

Thanks,

Pradeep


Please mark my answer as correct and helpful if it works for you.
Regards,
Pradeep.


Regards,
Pradeep

View solution in original post



1 Helpful

Reply



 * Previous Question
 * Next Question


1 REPLY 1


Go to solution
Pradeep Thipani
Kilo Sage

Options
 * Mark as New
 * Bookmark
 * Subscribe
 * Mute
 * 
 * Subscribe to RSS Feed
 * 
 * Permalink
 * Print
 * 
 * Report Inappropriate Content

4 hours ago

Hi Shiz,

 

You can achieve that by writing an OnLoad client script for the respective table
you are referring.

 

Here is a sample code you can refer:

function onLoad() {
    if (g_form.isNewRecord()) {
        var today = new Date();
        var day = today.getDay();
        // Calculate the Monday of the current week
        var monday = new Date(today.setDate(today.getDate() - (day === 0 ? 6 : day - 1)));
        g_form.setValue('week_start_on', monday.toISOString().split('T')[0]);
    }
}

 

Thanks,

Pradeep


Please mark my answer as correct and helpful if it works for you.
Regards,
Pradeep.


Regards,
Pradeep


1 Helpful

Reply



Post Reply
Related Content
 * How to pop up a confirmation message on UI Action Button in Developer forum
   Saturday
 * How to autofill new KA form with Incidident info from SOW with KCS Create
   Knowledge button in Developer forum Friday
 * Standard Ticket Configuration setup non-task extended in Developer forum
   Friday
 * Announcing ServiceNow IDE Version 1.1.0 🙌🏻🎉 in ServiceNow IDE, SDK, and
   Fluent articles Friday






THE WORLD WORKS WITH SERVICENOW™

 * Terms and conditions
 * GDPR
 * Privacy statement
 * Your privacy choices
 * Cookie policy
 * Cookie Preferences

 * 
 * 
 * 
 * 
 * 

©2024 ServiceNow. All rights reserved.

Top


Auto-suggest helps you quickly narrow down your search results by suggesting
possible matches as you type.