getFormRateItemValues offset result received
search cancel

getFormRateItemValues offset result received

book

Article ID: 44186

calendar_today

Updated On:

Products

CA Service Catalog

Issue/Introduction

While leveraging the getFormRateItemValues function, see example web service call in documentation, the date/time value returned is different from the date/time selected in the request.

Environment

Release: 14.1 or higher
Component:  CA Service Catalog

Cause

The date/time is stored in the database (usm_request_item_form) in GMT in Unix time and is then displayed in the UI based on the client browser machine timezone. 

So as an example, with system timezone set to EST, GMT -05:00 (which is currently GMT -04:00 with DST) if 6/15/2016 is selected at '00:00:00' the following is inserted into usm_request_item_form: 

1465963200000 

which converts to: 

Wed, 15 Jun 2016 04:00:00 GMT 

It is this value that is returned via getFormRateItemValues web service method. 

Resolution

There are a few potential options to obtain the actual date/time selected: 

1) If the timezone within the user object in Catalog is synchronized with the workstations then you can retrieve the timezone via the getUser web service method and adjust the date/time returned from getFormRateItemValues in a PAM process 

2) Include a hidden text field which is populated onChange of the date field or onSubmit of the form with the date/time selected via JavaScript similar to the following: 

ca_fdSetTextFieldValue(ca_fd.formId,'<hidden text field _id>',ca_fdGetDateFieldValue(ca_fd.formId,'<date field _id>')); 

3) Aside from the UNIX time stored in usm_request_item_form, there is also the literal date string selected from the date field stored. You could directly query the database similar to the following: 

select form_elem_value from usm_request_item_form where subscription_detail_id in (select id from usm_subscription_detail where request_id=<request id>) and form_elem_name='<date field _id>'