Java Script not saving two variables (date & Time) | Community
Skip to main content
bryceh57660644
Level 2
June 9, 2020
Solved

Java Script not saving two variables (date & Time)

  • June 9, 2020
  • 3 replies
  • 2491 views

I have two pages with the same issue.  I am trying to save date and time in two separate spots. When I test if the data is being captured in the form via an Alert() or debug mode, I am seeing that the values pass through, but they are not being saved

 

In the form:

 

Java Script

 

In the script after the web page:

 

Here are the page variables:

 Data Schema:

 

These variables have worked in the past but I am not sure what I have done to stop them from working.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jyoti_Yadav

Hi,

 

There are two points which you can check:

1) Value of variable ID, as you are doing insert or update operation, are you passing id value in your xtk.session.Write. If yes, then please check what is the value generated.

2) Typecast string variables to date and time data type.

 

Thanks.

3 replies

isahore
Community Advisor
Community Advisor
June 9, 2020

Hi @bryceh57660644 ,

 

Can you check in the javascript using logInfo(typeof <<variableName>>); what is the data type of the variables that are captured from the ctx.vars variables? Most probably the variables contactdate and contacttime in your javascript are of type String. You would need to typecast them before saving into your table.

Let me know if that helped?

Jyoti_Yadav
Jyoti_YadavAccepted solution
Level 8
June 10, 2020

Hi,

 

There are two points which you can check:

1) Value of variable ID, as you are doing insert or update operation, are you passing id value in your xtk.session.Write. If yes, then please check what is the value generated.

2) Typecast string variables to date and time data type.

 

Thanks.

Anita_punmiya
Level 5
June 11, 2020

Hi @bryceh57660644 ,

Check below in your script:

  •  The variable definitions are correct as per what you have declared in the form as storage
  •  try adding  "_key" in your xtk.session.write function as below:

             

Here "v_id" would be IDs in your case as you are trying to save the values for a particular record and I believe it is missing currently , hence you are not able to see the value getting inserted/updated.

 

Hope this helps.

Thanks.