cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1077
Views
0
Helpful
10
Replies

onSubmit action used to calculate a service form date field

Kevin Chua
Level 1
Level 1

onSubmit action used to calculate a service form date field

RequestCenter 2006.0.6

Developing a service that needs to take the value from one field (i.e., Length of Service) to calculate a Decommission Date field within the same dictionary.  Within my JavaScript, I'd like to get the Services' Due Date and perform some date arithmetic to calculate a new date field.

I'm wondering if this is possible with the onSubmit event., I have tried to get the Service/Requisition Due On date with the following namespaces:

Process.DueOn

Requsition.DueOn

Service.DueOn

Example javascript is:

var d = new Date();

d = Process.DueOn;

 

If it's possible, is this DueOn field a text or date type?

10 Replies 10

Coupla problems here:

(1) Namespaces are not active in a service form. Namespaces are strictly an artifact of the back-end business engine.

(2) You can't do this in an onSubmit event -- it's a timing issue. onSubmit events should not be used to update the values of form data. Populate the extra field you need in an onChange or onLoad event.

(3) The only way to get the service's due date would be to execute  a fetch against the newScale requisition tables.

(4) Once you have av

This is not a solution to your question, but it does provide an example of date field parsing and date comparisions using Javascript. Basically this function checks to see that the selected date is less than 180 days from today. If not, it pops up an alert, nulls out the date field and sets the focus on the date field.

validate_newContractorEndDate()
{
   if ( Moment == 'ordering' )
   {
 var oneDay =1000*60*60*24;
 var myDate = document.getEle

Emir E
Level 1
Level 1

Kevin, I have written a javascript that will calculate X number of Business days from a provided date. Please let me know if you want it...

Hi Emir,

We have been looking for a script that will calculate using Business days instead of calendar days.

I would certainly appreciate if you could share your script.

Kevin Chua
Level 1
Level 1

Hi Emir:

Yes, I will neeed to have to calculate business days after I'm able to fetch this information for my service.  At your earliest, please share your script.

 

Thanks,

Kevin

Daniel Faust
Level 1
Level 1

HI Emir:  I would also like to get a copy of that javascript - its been on my to do list and I havent had time to get it done.

Thank you
Daniel - Safeway

Emir E
Level 1
Level 1

I forgot to mention, since this will run on the client side it will use whatever time the user has set. It will not convert timezones, etc. It also does Day calculations only, I did not include the hours, although it would be pretty easy to add to it. Was not worth the effort for me

Emir E
Level 1
Level 1

Attached in calendar.zip please find:

cal.html - allows you to select a future installation date and calculates 10 day SLA in the past. This date can be used to fire of a task in the future.

bus.html - calculates 10 business days in the future from a provided date.

Hi Emir,

This is great. Thanks for sharing!!!

Pamela

Daniel Faust
Level 1
Level 1

Thanks Emir:
This will save me a lot of time.

Daniel - Safeway

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: