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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

V2 equivalent of context.getDevice

ablyth
7-Bedrock

V2 equivalent of context.getDevice

Hi,

 

Is there a V2 equivalent of context.getDevice that will return an Asset instead of a V1 Device object? If not, what would be the recommended method for obtaining the Asset object when a Custom Object is triggered by an Expression Rule?

 

Thanks!

Alan

2 REPLIES 2
cdovholuk
6-Contributor
(To:ablyth)

Unfortunately there is no way to get a v2 equivalent without fetching it back again as of the latest version of the Axeda Platform 6.8.

I would simply do:


import static com.axeda.sdk.v2.dsl.Bridges.*



Asset v2Asset = assetBridge.findById(context.getDevice().getId().toString())


//use the v2Asset


I recognize that's less than ideal but it'd work fine.

Cheers,

-Clint

ablyth
7-Bedrock
(To:ablyth)

Lovely one-liner,

Thanks Clint, i was hoping you'd be around and provide an excellent answer as always!

Alan,

Top Tags