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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Creating an asset on ManApps via service

aiGreek
7-Bedrock

Creating an asset on ManApps via service

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4

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

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.

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

Hi @hchanana,

 

thanks! I didn't know I needed to add the asset to a network (I didn't even know what they were) and that tags were required.

This solved my issue.

Regards.

Top Tags