Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Variable date field changes value on Requested Item form

pennieturner
Mega Guru

I have a variable called revoke_date which is a date field.

After entering the date on the request form as todays date, or another date, the item gets set up and when I open the item, the date shows as it was entered on the form.

If I save the form, or change the view a few times, the revoke_date then changes and shows as year 0013 or something similar, but always 00 at the front.   The days and months change too.

This is a variable, and nothing in the workflow is changing it.   I can't find out why its changing.

Any one any ideas where I can look?

Thanks in advance

3 REPLIES 3

pennieturner
Mega Guru

Going back through the items, the date keeps on changing!


I have the same issue, is there any solution for this?


Hi



I found the issue only related to a certain date format on the user profile dd-mm-yyyy.   Once I removed this from the user profile and used a different format the issue went away.



ServiceNow said it was to do with us using DOM manipulation in our code



They said this:



Solution Proposed: It is not recommended to use DOM manipulation.Instead, use the GlideForm API or consider a different approach for the solution.


In general, when using DOM manipulation methods, you have to reference an element in the DOM by id or using a CSS selector.When refrencing out-of-box elements, there is a risk that the element ID or placement within the DOM could change thus casuing the code to stop working and/or generate errors.While we are not saying this should never be done, it needs to be done with forethought, causion, and a full understanding of the risk you are incurring. It is recommended to review these objects and reduce the use of DOM manipulation methords as much as possiable.Next Steps: Please use UI Policies/GlideForm API calls to make variables read only or hide them.




We haven't changed our code, and it works OK as long as we don't use the dd-MM-yyy format on a user profile.




Regards