<?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>question Re: End date should not be more than 6 months from start date in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751651#M408577</link>
    <description>&lt;P&gt;Hi Dhananjay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I have tried exactly what you suggested and still is not working.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/203240i80B4C1ADA835056F/image-size/large?v=v2&amp;amp;px=999" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 15:35:55 GMT</pubDate>
    <dc:creator>Lakshman12</dc:creator>
    <dc:date>2020-07-22T15:35:55Z</dc:date>
    <item>
      <title>End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751634#M408560</link>
      <description>&lt;P&gt;I am working on functionality as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have two fields on catalog item includes – start date and end date. We do not want users to select end date not more than 6 months from start date.&lt;/P&gt;
&lt;P&gt;For example: start date = 07/22/2020&lt;/P&gt;
&lt;P&gt;&amp;nbsp;If End date = &amp;nbsp;1/22/2021 (technically difference is more than 180 days because of few months has 31 days ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Let us say if end user selects 1/23/2021 as end date, then I should alert them saying not to select as it is more than 6 months calendar days.&lt;/P&gt;
&lt;P&gt;I would really appreciate your help. &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="ce3fce65db181fc09c9ffb651f96192f"&gt;@Pradeep Sharma&lt;/SN-MENTION&gt; &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="19525629dbd81fc09c9ffb651f961989"&gt;@Ankur Bawiskar&lt;/SN-MENTION&gt; &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="7ae05a61db981fc09c9ffb651f9619a2"&gt;@Chuck Tomasi&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Lakshman&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 00:54:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751634#M408560</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T00:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751635#M408561</link>
      <description>&lt;P&gt;Hi Lakshman,&lt;/P&gt;
&lt;P&gt;Client Script : onChange (end date)&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '') {

return;

}

var ga = new GlideAjax('ScriptIncludeName');

ga.addParam('sysparm_name', 'addMonths');

ga.addParam('start_date', g_form.getValue('start_date'));

ga.addParam('months_to_add', 6);

ga.getXML(getEndDate);

}

function getEndDate(response) {

var answer = response.responseXML.documentElement.getAttribute("answer");

if (answer) {
if(g_form.getValue('end_date') &amp;gt; answer) {
alert("End date should be less than " + answer);
}

}
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Script Include :&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var ScriptIncludeName = Class.create();

ScriptIncludeName.prototype = Object.extendsObject(AbstractAjaxProcessor, {
addMonths: function() {

var start_date = this.getParameter('start_date');

var months = this.getParameter('months_to_add');
var gdt = new GlideDateTime(start_date);
gdt.addMonths(months);
return gdt.getDate();

},

}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will solve your issue of 180 days.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 02:27:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751635#M408561</guid>
      <dc:creator>Naveen Sagar S1</dc:creator>
      <dc:date>2020-07-22T02:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751636#M408562</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&amp;nbsp;Lakshman,&lt;/P&gt;
&lt;P&gt;Check out this threads, it will help you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=6a54dedadb1fa340d6a102d5ca961978" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=6a54dedadb1fa340d6a102d5ca961978&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=62964f25db1cdbc01dcaf3231f96195f" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=62964f25db1cdbc01dcaf3231f96195f&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=4a640b69dbd8dbc01dcaf3231f9619d7" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=4a640b69dbd8dbc01dcaf3231f9619d7&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=15658baddbd8dbc01dcaf3231f961936" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=15658baddbd8dbc01dcaf3231f961936&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mark&amp;nbsp;&lt;STRONG&gt;Correct&lt;/STRONG&gt;&amp;nbsp;and&amp;nbsp;&lt;STRONG&gt;Helpful&lt;/STRONG&gt;&amp;nbsp;if it helps!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Namrata.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 03:00:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751636#M408562</guid>
      <dc:creator>Namrata Khabale</dc:creator>
      <dc:date>2020-07-22T03:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751637#M408563</link>
      <description>&lt;P&gt;Hi Naveen,&lt;/P&gt;
&lt;P&gt;I am getting Null as return value from script include when I implemented yours.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Lakshman&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 04:14:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751637#M408563</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T04:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751638#M408564</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;Have you considered using a (Catalog) UI Policy to achieve date validations? There's almost no-code needed to achieve date validations this way. Have a look at an article I wrote on this:&lt;BR /&gt;&lt;A href="https://community.servicenow.com/community?id=community_article&amp;amp;sys_id=f61964aadbcb3fc85129a851ca9619eb" target="_blank" rel="noopener noreferrer nofollow"&gt;No Code date validations thru (Catalog) UI Policies&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Scripting data validations is a poor&amp;nbsp;choice and in most cases unnecessary.&lt;/P&gt;
&lt;P class="ng-scope"&gt;If my answer helped you in any way, please then mark it as helpful.&lt;/P&gt;
&lt;P class="ng-scope"&gt;Kind regards,&lt;BR /&gt;Mark&lt;BR /&gt;&lt;EM&gt;&lt;A href="https://community.servicenow.com/community?id=community_blog&amp;amp;sys_id=fb488720dbaacc504819fb2439961900" target="_blank" rel="noopener noreferrer nofollow"&gt;2020 ServiceNow Community MVP&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;A href="https://developer.servicenow.com/blog.do?p=/post/all-stars/" target="_blank" rel="noopener noreferrer nofollow"&gt;2020 ServiceNow Developer MVP&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="ng-scope"&gt;---&lt;/P&gt;
&lt;P class="ng-scope"&gt;&lt;A href="https://www.linkedin.com/in/markroethof/" target="_blank" rel="noopener noreferrer nofollow"&gt;LinkedIn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.servicenow.com/community?id=community_blog&amp;amp;sys_id=14e51965db2200d013b5fb24399619fb" target="_blank" rel="noopener noreferrer nofollow"&gt;Community article list&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 04:59:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751638#M408564</guid>
      <dc:creator>Mark Roethof</dc:creator>
      <dc:date>2020-07-22T04:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751639#M408565</link>
      <description>&lt;P&gt;Hey Lakshman,&lt;/P&gt;
&lt;P&gt;Check out this below similar thread it will help you,&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=409035e0dbcfb3c414d6fb2439961965" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=409035e0dbcfb3c414d6fb2439961965&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;kindly mark Correct and Helpful if Applicable.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Indrajit.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 05:39:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751639#M408565</guid>
      <dc:creator>Indrajit</dc:creator>
      <dc:date>2020-07-22T05:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751640#M408566</link>
      <description>&lt;P&gt;Hello Lakshman ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please paste this code in your onchange client script , no need to write server side script,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To check selected date is within future 6 month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt; var datesplit = (newValue+'').split('-');&lt;BR /&gt; var date= new Date(datesplit[2],datesplit[0]-1,datesplit[1]);&lt;BR /&gt; &lt;BR /&gt;// for current date&lt;BR /&gt; var MaxStartDate = new Date();&lt;BR /&gt; &lt;BR /&gt;// add six months in current date.&lt;BR /&gt; MaxStartDate.setDate(MaxStartDate.getDate() + 180);&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; if(date&amp;gt;MaxStartDate)&lt;BR /&gt; {&lt;BR /&gt; &lt;BR /&gt; alert('selected date :'+date&lt;BR /&gt; +'Max date : '+sixmonthdate&lt;BR /&gt; +'Please select valid date');&lt;BR /&gt; &lt;BR /&gt; }&lt;BR /&gt; else &lt;BR /&gt; {&lt;BR /&gt; alert('valid date');&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mark&amp;nbsp;&lt;STRONG&gt;Correct&lt;/STRONG&gt;&amp;nbsp;and&amp;nbsp;&lt;STRONG&gt;Helpful&lt;/STRONG&gt;&amp;nbsp;if it helps .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Arjun Shinde&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 05:53:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751640#M408566</guid>
      <dc:creator>Arjun31</dc:creator>
      <dc:date>2020-07-22T05:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751641#M408567</link>
      <description>&lt;P&gt;Hi Lakshman,&lt;/P&gt;
&lt;P&gt;Addition to Namrta, check this link&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.servicenowguru.com/scripting/client-scripts-scripting/client-side-dates-in-servicenow/" rel="nofollow"&gt;https://www.servicenowguru.com/scripting/client-scripts-scripting/client-side-dates-in-servicenow/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If my answer helped you in any way, mark answer as helpful and correct.&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;
&lt;P&gt;Megha&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 05:56:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751641#M408567</guid>
      <dc:creator>Megha Padale</dc:creator>
      <dc:date>2020-07-22T05:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751642#M408568</link>
      <description>&lt;P&gt;Hi Lakshman,&lt;/P&gt;
&lt;P&gt;In addition to above, I will suggest you to try no code solution which will be best to keep system performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create catalog ui policy as below and change variable names as per requirement.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/203243i64DB0E9551F4A63E/image-size/large?v=v2&amp;amp;px=999" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/203244i9D055088DBE44DE3/image-size/large?v=v2&amp;amp;px=999" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mark correct and helpful based on impact.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Dhananjay.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 06:04:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751642#M408568</guid>
      <dc:creator>Dhananjay Pawar</dc:creator>
      <dc:date>2020-07-22T06:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751643#M408569</link>
      <description>&lt;P&gt;Apologies, my bad can you replace&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;start_date with sysparm_start_date&lt;/LI&gt;&lt;LI&gt;months_to_add with sysparm_months_to_add&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;in both the client script and script include. That should work fine.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 12:18:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751643#M408569</guid>
      <dc:creator>Naveen Sagar S1</dc:creator>
      <dc:date>2020-07-22T12:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751644#M408570</link>
      <description>&lt;P&gt;Naveen,&lt;/P&gt;
&lt;P&gt;Still the same issue -- getting Null from script include.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 12:43:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751644#M408570</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T12:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751645#M408571</link>
      <description>&lt;P&gt;Arjun,&lt;/P&gt;
&lt;P&gt;Thanks for sharing the script. I have already used the similar script but it is not including 31 first day of few months. for example from 7/22/2020 through 01/23/2021 -- there are 4 extra days, i.e means 184.&lt;/P&gt;
&lt;P&gt;so, I am looking for something which can include extra days as well.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Lakshman&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 12:47:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751645#M408571</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T12:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751646#M408572</link>
      <description>&lt;P&gt;Any luck on this? Any questions?&lt;/P&gt;
&lt;P class="ng-scope"&gt;If my answer helped you in any way, please then mark it as helpful.&lt;/P&gt;
&lt;P class="ng-scope"&gt;Kind regards,&lt;BR /&gt;Mark&lt;BR /&gt;&lt;EM&gt;&lt;A href="https://community.servicenow.com/community?id=community_blog&amp;amp;sys_id=fb488720dbaacc504819fb2439961900" target="_blank" rel="noopener noreferrer nofollow"&gt;2020 ServiceNow Community MVP&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;A href="https://developer.servicenow.com/blog.do?p=/post/all-stars/" target="_blank" rel="noopener noreferrer nofollow"&gt;2020 ServiceNow Developer MVP&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="ng-scope"&gt;---&lt;/P&gt;
&lt;P class="ng-scope"&gt;&lt;A href="https://www.linkedin.com/in/markroethof/" target="_blank" rel="noopener noreferrer nofollow"&gt;LinkedIn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.servicenow.com/community?id=community_blog&amp;amp;sys_id=14e51965db2200d013b5fb24399619fb" target="_blank" rel="noopener noreferrer nofollow"&gt;Community article list&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 12:56:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751646#M408572</guid>
      <dc:creator>Mark Roethof</dc:creator>
      <dc:date>2020-07-22T12:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751647#M408573</link>
      <description>&lt;P&gt;can you share the code because it is working fine for me with following code&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    //Type appropriate comment here, and begin script below

    var ga = new GlideAjax('ScriptIncludeName');

    ga.addParam('sysparm_name', 'addMonths');

    ga.addParam('start_date', g_form.getValue('start_date'));

    ga.addParam('months_to_add', 6);

    ga.getXML(getEndDate);

}

function getEndDate(response) {

    var answer = response.responseXML.documentElement.getAttribute("answer");
	alert(answer);
    if (answer) {
        if (g_form.getValue('end_date') &amp;gt; answer) {
            alert("End date should be less than " + answer);
        }

    }

}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var ScriptIncludeName = Class.create();
ScriptIncludeName.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    addMonths: function() {

        var start_date = this.getParameter('start_date');
        var months = this.getParameter('months_to_add');
        var gdt = new GlideDateTime(start_date);
        gdt.addMonths(months);
        return gdt.getDate();

    },

    type: 'ScriptIncludeName'
});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jul 2020 13:02:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751647#M408573</guid>
      <dc:creator>Naveen Sagar S1</dc:creator>
      <dc:date>2020-07-22T13:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751648#M408574</link>
      <description>&lt;P&gt;Hi Lakshman,&lt;/P&gt;
&lt;P&gt;Did you get chance to work on my comment?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Dhananjay.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 13:05:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751648#M408574</guid>
      <dc:creator>Dhananjay Pawar</dc:creator>
      <dc:date>2020-07-22T13:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751649#M408575</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Lakshman,&lt;/P&gt;
&lt;P&gt;Yes correct so you can replace&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MaxStartDate.setDate(MaxStartDate.getDate() + 180); this line of code with&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MaxStartDate.setMonth(MaxStartDate.getMonth() + 6);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you will get exact date you are looking for.&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Arjun Shinde&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 13:58:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751649#M408575</guid>
      <dc:creator>Arjun31</dc:creator>
      <dc:date>2020-07-22T13:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751650#M408576</link>
      <description>&lt;P&gt;Arjun,&lt;/P&gt;
&lt;P&gt;here is what I have tried exactly as you mentioned but still not working.&lt;/P&gt;
&lt;P&gt;var datesplit = (newValue + '').split('-');&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; alert(datesplit);&amp;nbsp;// &lt;STRONG&gt;output when I select 01/23/2021 ==&amp;nbsp;2021,01,23&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var date = new Date(datesplit[2], datesplit[0] - 1, datesplit[1]);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; alert("date : "+date); // output&amp;nbsp; ==&amp;nbsp;&lt;STRONG&gt;date : Tue May 01 2091 00:00:00 GMT-0400 (Eastern Daylight Time)&amp;nbsp;&lt;/STRONG&gt;---&amp;gt; which is 2091 (failed case), how can it be 2091 after spliting&lt;BR /&gt;&lt;BR /&gt; var MaxStartDate = new Date();&lt;BR /&gt; MaxStartDate.setMonth(MaxStartDate.getMonth() + 6);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; if (date &amp;gt; MaxStartDate) {&lt;BR /&gt; g_form.showFieldMsg('end_date', 'End Date should not be more than 6 months from start date', 'error');&lt;BR /&gt; g_form.clearValue('end_date');&lt;BR /&gt; } else {&lt;BR /&gt; g_form.hideFieldMsg('end_date');&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;Note:&lt;/SPAN&gt; I am writing this script in HR scoped application, not sure if this method works in scoped app.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:30:48 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751650#M408576</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T15:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751651#M408577</link>
      <description>&lt;P&gt;Hi Dhananjay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I have tried exactly what you suggested and still is not working.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/203240i80B4C1ADA835056F/image-size/large?v=v2&amp;amp;px=999" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:35:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751651#M408577</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T15:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751652#M408578</link>
      <description>&lt;P&gt;Mark,&lt;/P&gt;
&lt;P&gt;I have tried creating UI policy as suggested, but not working.&lt;/P&gt;
&lt;P&gt;Note: I have written this in HR scoped application, not sure whether this matters.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Lakshman&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:43:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751652#M408578</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T15:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: End date should not be more than 6 months from start date</title>
      <link>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751653#M408579</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="fcf21ea1db1c1fc09c9ffb651f9619cf"&gt;@asifnoor&lt;/SN-MENTION&gt;&amp;nbsp;Checking if you can help me on this please.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Lakshman&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:46:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/end-date-should-not-be-more-than-6-months-from-start-date/m-p/1751653#M408579</guid>
      <dc:creator>Lakshman12</dc:creator>
      <dc:date>2020-07-22T15:46:52Z</dc:date>
    </item>
  </channel>
</rss>

