Skip to main content
1-Visitor
Jun 23, 2017 9:37 AM UTC
Question

addorupdatealert method not working?

I  ran AddOrUpdateAlert() code through a service in order to create an alert progamatically

the code is taken from ptc page  Digital Media Publisher

when I run the service it executes successfully
but
I cannot see the alert on my property
I ran the generic method GetAlertDefinition()
It showed my thing but it is not showing it on the property

also when I save the Thing the alert disappears from  GetAlertDefinition() also

I cannot figure out why?
I have made sure that persistent is set to true in AddOrUpdateAlert()
also i tried restarting and enabling thing

Thank you for any help

6 replies

5-Regular Member
Jun 23, 2017 12:06 PM UTC

Hi Jugal Shah​,

Try following: After running the Alert Creation service ; close your Thing entity (do not click the save button) and reopen it again.

Based on the information shared by you; it seems that Alert is created. It's just that your composer is not refreshed.

Translate
5-Regular Member
Jun 23, 2017 12:09 PM UTC

If it still not work. Share your entities and I can have a look.

Translate
jshah-31-VisitorAuthor
1-Visitor
Jun 23, 2017 12:33 PM UTC

thank you it worked

but I have to manually close a thing

In my scenario in a service  I am iterating over a infotable (each row of infotable represents a different thing) and for each row I will be creating a alert

which means I am creating an alert for many things

Thus before running the service I have to make sure I close all the things in the infotable

Instead of manually closing it is it possible to problematically close a thing?

Translate
5-Regular Member
Jun 27, 2017 3:26 AM UTC

Hi Jugal Shah​,

We actually don't need to close the Thing. Saving the entity after running the service is overriding the changes done by service (in the background).

Just refresh the composer after running the service to load the latest entity data from the background. Make sure NOT to click save button before the refresh.

Translate
jshah-31-VisitorAuthor
1-Visitor
Jun 27, 2017 4:40 AM UTC

can I refresh the composer programatically

rather than maually?

Translate
jshah-31-VisitorAuthor
1-Visitor
Jun 28, 2017 5:55 AM UTC

I thing this can be consider  a bug in thingworx  know?

so Where can I raise a bug ?

Translate