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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

How to create a subscription on a thing from within a script

sveneman
7-Bedrock

How to create a subscription on a thing from within a script

Hello everyone, 

i want do add a subscription to a Thing from within a script but i don't seem to be able to do so. I have tried using EnableSubscription which is not what i'm looking for since it simply activates or disables an already existing subscription. I have also tried using AddDynamicSubscription but this subscription is only in-memory which is not what i want. Is there any way to just add a subscription to a thing from a script like you would when using the editor?

 

Thanks in advance!

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:sveneman)

Right now you can't use a script to create a persistent subscription.

Is there a reason why you need to create it dynamically?

What you can create persistently is Alerts so if you have standard handling, you can create alerts into a AnyAlert subscription.

If they have to be dynamic, then you will need to 

1. create them on demand

2. store the ones that you've created so they can be recreated during ThingStart

View solution in original post

1 REPLY 1
PaiChung
22-Sapphire I
(To:sveneman)

Right now you can't use a script to create a persistent subscription.

Is there a reason why you need to create it dynamically?

What you can create persistently is Alerts so if you have standard handling, you can create alerts into a AnyAlert subscription.

If they have to be dynamic, then you will need to 

1. create them on demand

2. store the ones that you've created so they can be recreated during ThingStart

Announcements


Top Tags