Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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
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
Lovely one-liner,
Thanks Clint, i was hoping you'd be around and provide an excellent answer as always!
Alan,