cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

DateTime property on Users (via UserExtensions) is not persisting.

SOLVED
Highlighted
Newbie

DateTime property on Users (via UserExtensions) is not persisting.

I am developing on Thingworx 7.0.3

I am having an issue setting DateTime property values on Users from within Java extension package code and having the data persist across Tomcat restarts

Even  in this simple example utilizing a service, the date will not persist over a Tomcat reboot.

However, if I set this value via Composer, it will persist across a Tomcat reboot.

@ThingworxServiceDefinition(name="Test", description ="")

  @ThingworxServiceResult(name="result", description="", baseType="STRING")

  public String Test() throws Exception {

  User usr = EntityTools.GetUser("myUsername");

  usr.setPropertyValue("LastSync", new DatetimePrimitive(DateTime.now()));

  return "finished";

  }

I have also tried setting this via this line, as well, just to see, but with no change.

usr.setPropertyValue(DevicifyConstants.GLOBAL_PROPERTY_LAST_UPDATE_TO_SFDC, new DatetimePrimitive(DateTime.now().getMillis()));

Any ideas?

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: DateTime property on Users (via UserExtensions) is not persisting.

Sure enough this is a bug, and it is fixed by both 7.2.5 and 7.0.6

View solution in original post

4 REPLIES 4
Highlighted

Re: DateTime property on Users (via UserExtensions) is not persisting.

Jason Geiger​, Do you see the updated value in composer after running the extension service?

Highlighted

Re: DateTime property on Users (via UserExtensions) is not persisting.

Yes. Everything looks great, until a Tomcat restart.

Highlighted

Re: DateTime property on Users (via UserExtensions) is not persisting.

More info here, got some time to get back to this. I am beginning to suspect this is a bug so I will put in a case.

I've tried all three constructors for DatetimePrimitive, all accept the date and do not error but tomcat restart looses the data.

The final one, not mentioned above:

DatetimePrimitive dt = new DatetimePrimitive();

dt.setValue(DateTime.now());

usr.setPropertyValue(DevicifyConstants.GLOBAL_PROPERTY_LAST_UPDATE_TO_SFDC, dt);

I have tried initializing DateTime various ways but that is not it either.

I want to test this on 7.2.x to see if it's there but in the meantime I am going to put in a ticket.

Highlighted

Re: DateTime property on Users (via UserExtensions) is not persisting.

Sure enough this is a bug, and it is fixed by both 7.2.5 and 7.0.6

View solution in original post

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!