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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

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

jasong
12-Amethyst

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?

ACCEPTED SOLUTION

Accepted Solutions
jasong
12-Amethyst
(To:jasong)

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
ankigupta
12-Amethyst
(To:jasong)

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

jasong
12-Amethyst
(To:ankigupta)

Yes. Everything looks great, until a Tomcat restart.

jasong
12-Amethyst
(To:jasong)

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.

jasong
12-Amethyst
(To:jasong)

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

Announcements


Top Tags