Skip to main content
1-Visitor
February 12, 2021
Solved

Creating an asset on ManApps via service

  • February 12, 2021
  • 1 reply
  • 2496 views

Greetings.

I need to create a thing via a service (which will be called from a mashup) to create a thing, which will then be displayed on the Manufacturing Apps.

I've read this document and a few forum topics, which say that I must set the displayName property to something in order for the thing/asset to be visualized in the ManApps screen.

Unfortunately, this doesn't seem to be working. I've tried creating things with my company's custom thing template (which is based on the PTC.ISA95.PhysicalAssetThingTemplate) and even with the  PTC.ISA95.PhysicalAssetThingTemplate template itself, but it didn't solve my issues and I'm still unable to see the asset on the ManApps.

Thank you for your time.

Best answer by hchanana

Hi @aiGreek ,

 

With the given service, you are only creating an asset.

To display asset in manufacturing apps, it should be a part of network and context. So you need to modify the service to add asset to a particular network and need to add model tags as well to it.

 

Thanks,

Himanshu

1 reply

16-Pearl
February 12, 2021

Hi @aiGreek ,

 

Can you please share the service code which you are using to create assets.

 

Make sure to call EnableThing() and RestartThing() service on individual asset in your code.

 

Thanks,

Himanshu

aiGreek1-VisitorAuthor
1-Visitor
February 15, 2021

Hi @hchanana,

 

here's the code I wrote:

 

var thingName = 'testManAppsThingService';

var params = {
	name: thingName /* STRING */,
	description: 'TEST - TO BE DELETED' /* STRING */,
	thingTemplateName: 'Danieli.AMS.iHydTemplate' /* THINGTEMPLATENAME */,
	tags: undefined /* TAGS */
};

// no return
Resources["EntityServices"].CreateThing(params);

Things[thingName].displayName = 'testManufacturingAppsAsset';

Things[thingName].EnableThing();
Things[thingName].RestartThing();

 

 

I didn't call Enable and RestartThing in my first draft, but calling them made no difference unfortunately.
I noticed that the displayName property isn't getting properly updated, should I call Enable and RestartThing before trying to change its value? EDIT: I tried this, and it now properly sets the displayName property, but it's still not showing on the ManApps.
Also, even after manually setting the display name property from the composer the asset isn't displayed on ManApps.


Thank you for your time.

hchanana16-PearlAnswer
16-Pearl
February 17, 2021

Hi @aiGreek ,

 

With the given service, you are only creating an asset.

To display asset in manufacturing apps, it should be a part of network and context. So you need to modify the service to add asset to a particular network and need to add model tags as well to it.

 

Thanks,

Himanshu