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

7.4 platform getID of organizations returning org name instead of ID

SOLVED
Highlighted
Newbie

7.4 platform getID of organizations returning org name instead of ID

We are upgrading from an older version of thingworx in which our extension used the getID method for organizations to get their IDs. Now we are upgraded to, it returns the organization Name#Organization instead of the ID.

Original code:

Organization org = OrganizationManager.getInstance().getEntity(organizationName);

    return org.getID();

New 7.4 code:

   

Organization org = (Organization) EntityUtilities.findEntity(organizationName, ThingworxRelationshipTypes.Organization);

  return org.getID();

What can I change to get the organization ID in 7.4, or are IDs no longer supported in 7.4? I saw that the getID method is still available through the super but I cannot get it to return the ID.

Organization org = (Organization) EntityUtilities.findEntity(organizationName, ThingworxRelationshipTypes.Organization);

  _logger.debug(org.toString());

  return org.getID();

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

As an update from the R&D, this works to Thingworx specs.

The id returned is dependent on the persistence provider being used. For the neo4j provider, the entity ids are a number converted to a string (e.g., "47"). For other providers the entity ids are of the form "<EntityName>#<EntityType>" (e.g., "Everyone#Organization").

Since you've been using neo4j in 6.0, and are now on a different persistence provider, this accounts for the perceived behavior difference.

View solution in original post

10 REPLIES 10
Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

Camron could you please let us know from which version you have upgraded to ThingWorx 7.4? You are right could see the getID() still there

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

We were on 6.0.0-b542.

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

Cameron I have reported a Jira TW-19102 on this will keep you updated. Is it possible for you to open a support case in the meantime? if not I can do that for you.

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

I opened a support case. Thanks, I saw someone posted (then deleted) that there is no organizationID in 7.x is that true?

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

I've  taken the ownership of your case. I do have a vague memory of this becoming obsolete, however, I am trying to confirm that right now.

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

Awesome thanks, I did see that the organizations still have a ID property but it is just the "organizationName#Organization" now instead of the organizationID like previously.

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

For the completion sake here's the link to the public knowledge base article filed for tracking this issue and the Jira filed for it https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS261848&lang=en_US

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

As an update from the R&D, this works to Thingworx specs.

The id returned is dependent on the persistence provider being used. For the neo4j provider, the entity ids are a number converted to a string (e.g., "47"). For other providers the entity ids are of the form "<EntityName>#<EntityType>" (e.g., "Everyone#Organization").

Since you've been using neo4j in 6.0, and are now on a different persistence provider, this accounts for the perceived behavior difference.

View solution in original post

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

Good to know, is there a way to access the original orgID's that were created in neo4j? We did switch from neo4J to postgres with the upgrade. Our datatable's use the orgID's in the name so that's how we look them up. We could change all of them to use the orgName#Organization instead, but that would be a largely manual process.

Highlighted

Re: 7.4 platform getID of organizations returning org name instead of ID

I don't think it is now possible with a different database, unfortunately. As getID wasn't ever intended to be used in such a way for organizations, and was rather a nuance of the neo db, this is not a feature that was taken care of or thought of when migrating to postgres.

Announcements

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