<?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: Setting Due Date Field in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887163#M458942</link>
    <description>&lt;P&gt;Hi Justin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You mention that the field you want to reference is on the sc_task, but then the script you provided seems to indicate that the field is actually a variable on the catalog item (which then populates in the variables on the requested item and catalog task. I'm going to work from the assumption that you have a custom field on the sc_task table that staff is updating and that you want that to trickle up to the requested item. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You'll want to create a business rule on the sc_task table. Make it a "before" rule and on "update".&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Add a condition that u_planned_completion_date changes&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Check off "advanced" so you can do some scripting&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;In the script try something like this:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var t = new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;t.addQuery('request_item',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;t.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var date = '';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;while(t.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(date == ''){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;date = t.u_planned_completion_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;else if(t.u_planned_completion_date &amp;gt; date){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;date = t.u_planned_completion_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var r = new GlideRecord('sc_req_item');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;r.addQuery('sys_id',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;r.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(r.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;r.due_date = date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 27 Jan 2017 13:50:18 GMT</pubDate>
    <dc:creator>kristenankeny</dc:creator>
    <dc:date>2017-01-27T13:50:18Z</dc:date>
    <item>
      <title>Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887160#M458939</link>
      <description>&lt;P&gt;I am attempting to set the due_date field on the catalog requested item form to pull from a user created field (u_planned_completion_date) on the sc_task table. &amp;nbsp; Preferably, if the item has multiple tasks, it would use the last Planned Completion Date available. &amp;nbsp; For some background, I'm doing this to override the auto-calculated "Expected Delivery Date of Completed Order" that the user sees when a request is submitted. &amp;nbsp; I would like this to be blank until the work is planned and the Planned Completion Date field is filled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I, honestly, don't even know where to start on this one. &amp;nbsp; I'm not technically inclined, as I usually work on front-end, user experience with SNOW. &amp;nbsp; Any and all help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The closes thing I can think of would be something like:&lt;/P&gt;&lt;P&gt;task.due_date = current.variables.u_planned_completion_date;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, I'm fairly certain that's not even close. &amp;nbsp; I'm thinking it's going to have to be a more complicated client script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:37:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887160#M458939</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T13:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887161#M458940</link>
      <description>&lt;P&gt;Hi Justin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You can do this with a before business rule to automatically trigger or you can use a UI action to manually trigger it.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;The key is to find all child requests and find the greatest value for the u_planned_completion_date field. Something like this:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Standard disclaimer: The following code is untested, requires review and potential modifications (specifically field names)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;// Assumption: This is running on the sc_req_item table&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;(function () { &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var max = new GlideDateTime('1970-01-01 00:00:00');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; var rec = new GlideRecord('sc_task'); &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; rec.addQuery('request_item', current.request_item); &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; rec.query(); &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (rec.next()) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (rec.u_planned_completion_date &amp;gt; max)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; max = rec.u_planned_completion_date; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.u_planned_completion_date = max;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;})(); &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:44:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887161#M458940</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2017-01-27T13:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887162#M458941</link>
      <description>&lt;P&gt;I'll give that a try and let you know how that works, Chuck. &amp;nbsp; Thank you!&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:46:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887162#M458941</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T13:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887163#M458942</link>
      <description>&lt;P&gt;Hi Justin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You mention that the field you want to reference is on the sc_task, but then the script you provided seems to indicate that the field is actually a variable on the catalog item (which then populates in the variables on the requested item and catalog task. I'm going to work from the assumption that you have a custom field on the sc_task table that staff is updating and that you want that to trickle up to the requested item. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You'll want to create a business rule on the sc_task table. Make it a "before" rule and on "update".&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Add a condition that u_planned_completion_date changes&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Check off "advanced" so you can do some scripting&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;In the script try something like this:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var t = new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;t.addQuery('request_item',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;t.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var date = '';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;while(t.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(date == ''){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;date = t.u_planned_completion_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;else if(t.u_planned_completion_date &amp;gt; date){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;date = t.u_planned_completion_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var r = new GlideRecord('sc_req_item');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;r.addQuery('sys_id',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;r.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(r.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;r.due_date = date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:50:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887163#M458942</guid>
      <dc:creator>kristenankeny</dc:creator>
      <dc:date>2017-01-27T13:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887164#M458943</link>
      <description>&lt;P&gt;Kristen,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks for the help! &amp;nbsp; I tried adding that business rule and it was unsuccessful. &amp;nbsp; It seems to do a strange thing to the due date on the task record, and did not change the due date on the requested item record. &amp;nbsp; I'm wondering if the date references in the middle of the script should be due_date...but, again, I know nothing about this stuff. &amp;nbsp; I'm just trying to get stuff done while our scripting person is out for a few weeks.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 14:00:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887164#M458943</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T14:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887165#M458944</link>
      <description>&lt;P&gt;Can you provide a screenshot of the two records you want to update with the fields highlighted? Perhaps I'm not understanding the need. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 14:35:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887165#M458944</guid>
      <dc:creator>kristenankeny</dc:creator>
      <dc:date>2017-01-27T14:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887166#M458945</link>
      <description>&lt;P&gt;I would like this field:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/95035i3B5DCCDB6E3F4313/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;to populate this field:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/95037iEB4E84F361F9448F/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;So the user sees the Planned Completion Date - or the latest Planned Completion Date from all tasks included in the request - here:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/95034i319C6FC91FBF0750/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 14:48:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887166#M458945</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T14:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887167#M458946</link>
      <description>&lt;P&gt;Hi Justin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;The estimated deliver date of the completed order on that final screenshot is created from the workflow, if I remember right. It is "estimated". Users only see that when they do the final checkout (someone may correct me on that.)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Normally the tasks come along later in the process, so I am confused on the timing. If someone ordered something on Tuesday and you don't create tasks until later in the workflow (say Thursday), then how can you show them a different number on the checkout screen based on tasks that don't exist yet.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I get the idea of moving the latest task to the RITM. The scripts above should get you in that direction.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 14:56:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887167#M458946</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2017-01-27T14:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887168#M458947</link>
      <description>&lt;P&gt;Chuck,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;The requester can always check the status of the request. &amp;nbsp; You are correct in that the estimated completion date of the request is calculated from the stages/tasks in the workflow. &amp;nbsp; However, we're just starting to implement our Service Catalog. &amp;nbsp; We're starting with a very general service request option where the user basically just fills out a free form box with a description of the work they would like to have completed. &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;With this general use, there's no way to estimate or have a general schedule for the work that is to be completed since it could be something as small as requesting access to a system or as complex as upgrading a software across multiple data centers. &amp;nbsp; This particular route only has a single item and a single task (fulfill the request), which is generated immediately after the request is submitted.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:04:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887168#M458947</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T15:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887169#M458948</link>
      <description>&lt;P&gt;Chuck - isn't that view of the request the "self service" - no matter if it's upon submission or you open your request later? I think you're right though, it originates from the workflows - though this is at the request level - so is that trickling up from each requested item? We removed this from our layouts to prevent false expectations with our end users. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Justin - can you explain what you mean by strange things happening with the due date on the task? There may already be some business rules in place, either on the sc_req_item table or on the sc_task table that are causing some sort of recursive issue.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:04:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887169#M458948</guid>
      <dc:creator>kristenankeny</dc:creator>
      <dc:date>2017-01-27T15:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887170#M458949</link>
      <description>&lt;P&gt;Kristen,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;So the due date field on the task (which I will probably hide when we go to production because it's not relevant) is populating with a date two months out. &amp;nbsp; I do have a schedule currently set up on the item workflow, but the stage/task is only scheduled to take 14 business days. &amp;nbsp; Now, looking back to some of the requests that I was testing before I tried your script, it was a "feature" that was happening before I added that business rule.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:10:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887170#M458949</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T15:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887171#M458950</link>
      <description>&lt;P&gt;Okay, so the only remaining issue is updating the requested item's due date based on the planned completion date? What type of field is the planned completion date? I noticed OOB, the due date is a date/time field.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:16:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887171#M458950</guid>
      <dc:creator>kristenankeny</dc:creator>
      <dc:date>2017-01-27T15:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887172#M458951</link>
      <description>&lt;P&gt;Correct. &amp;nbsp; Planned Completion Date is a user created, date/time field.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:19:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887172#M458951</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T15:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887173#M458952</link>
      <description>&lt;P&gt;Hi Justin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Just realized I missed a line of code (the update of the request item).&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;var t = new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;t.addQuery('request_item',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;t.query();&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;var date = '';&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;while(t.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;if(date == ''){&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;date = t.u_planned_completion_date;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;else if(t.u_planned_completion_date &amp;gt; date){&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;date = t.u_planned_completion_date;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;var r = new GlideRecord('sc_req_item');&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;r.addQuery('sys_id',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;r.query();&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;if(r.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;r.due_date = date;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;r.update();&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;}&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:20:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887173#M458952</guid>
      <dc:creator>kristenankeny</dc:creator>
      <dc:date>2017-01-27T15:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887174#M458953</link>
      <description>&lt;P&gt;So I tried that, and it altered the "Expected Delivery Date of Complete Order" on the user view of the request, which is good. &amp;nbsp; However, when I fill out the Planned Completion Date field and update the task record, it is not updating or completing the Due Date field on the item. &amp;nbsp; That field is now blank, which is making the "Estimated Delivery Date of Complete Order" also blank.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 15:33:19 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887174#M458953</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T15:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887175#M458954</link>
      <description>&lt;P&gt;Ok, after some testing in a personal dev, I found that this works, but it should be an "after" business rule:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var t = new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; t.addQuery('request_item',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; t.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var date = new GlideDateTime('1999-01-01 00:00:00');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; while(t.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var pd = t.u_planned_completion_date.getGlideObject();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; if(date.getDisplayValue() == '1999-01-01 00:00:00'){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; date = pd;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; else if(t.u_planned_completion_date &amp;gt; date){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; date = pd;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; var r = new GlideRecord('sc_req_item');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; r.addQuery('sys_id',current.request_item);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; r.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; if(r.next()){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; r.due_date = date.getDisplayValue();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; r.update();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; }&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 16:58:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887175#M458954</guid>
      <dc:creator>kristenankeny</dc:creator>
      <dc:date>2017-01-27T16:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Due Date Field</title>
      <link>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887176#M458955</link>
      <description>&lt;P&gt;PERFECT!! &amp;nbsp; Thank you so much Kristen. &amp;nbsp; I cannot tell you how much I appreciate all of the help!&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Jan 2017 17:03:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/setting-due-date-field/m-p/887176#M458955</guid>
      <dc:creator>jcsmith</dc:creator>
      <dc:date>2017-01-27T17:03:04Z</dc:date>
    </item>
  </channel>
</rss>

