Using setValue to populate a date field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2011 08:10 AM
I'm trying to use the 'variable.setValue' to populate a date field. The formatting of the date value is 28-Sep-2011 and manually putting the value into the date field works perfectly fine. In addition I know my script is working because I pointed it to the text field and it populated just fine.
Anyone else have experience with setValue and date fields?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2011 09:48 AM
Can you share more of your code? Are you using
?
g_form.setValue('variable', dateValue)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2011 10:14 AM
Sorry for not being more specific.
I'm not specifically using g_form, but for the example I am following your example.
g_form.setValue('u_mycreated_date_field', dateValue);
Where dateValue is in a format of 28-Sep-2011 and u_mycreated_date_field is a date field.
It works perfectly field if I point it to a text field, like comments, on the form, but not if I'm setting it to a date field. What is even stranger I can copy and paste the date example manually into the field and it works fine.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2011 10:33 AM
How are you trying to set it out of the following two examples: sounds like you might be doing it server side in a business rule (i.e.
) vs client side in a client script (i.e.
current.dateField.setValue(value);
g_form.setValue('dateField', value);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2011 11:37 AM
Nope, we have added a date field to SQL Instances so we can better track when the last time discovery found them. (There is a last discovered for Servers but not Instances)
With the probe we're setting the date value and passing it to the sensor.
Within the sensor we're trying to apply the date value to the date field.
I'm using the g_form.setValue('dateField', value); method as its being used throughout the sensor script to successfully populate all of our other fields. Again, manually the date field will accept the formatted date value and via the sensor I can populate a text field with the result, but the date field will not accept the value.
Thanks again.