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
Looking for a way to send automated daily emails with the KPI Reports from RTPPM. I have a VP that does not want to log in to ThingWorx. What's the best way to accomplish this? I imagine I can create a service to do this but was curious if there was an easier to accomplish this (perhaps a "built in" feature of RTPPM?)
Solved! Go to Solution.
Hi Cruz.
You need 3 parts : the email engine configuration, a Scheduler to trigger it daily, and the subscription that will be called to prepare the email.
Part #1 : engine configuration. As Pehowe mentioned, there's an extension you can attach to Thingworx to help you with it. Even better news : RTPPM comes with one, so it should already be installed. However you may need to finish configuring it. See this link for more info on how to configure it. Notably, you will have to configure Thing PTC.FSU.CORE.Notification.Notification_TG which has the SendMessage service on it.
Part #2 : Scheduler. This should be simple, in Composer you can create a new Timer or Scheduler to trigger daily at the time you select. A Scheduler is probably better than a Timer for you in this case. Then on that new Scheduler, you can create the subscription that will listen to Me -> ScheduledEvent. The code will go there.
Part #3 : subscription. In the subscription, you will need to get the results of the KPIs and then call the SendMessage service. For the KPIs, you can look at HK's answer below, he's calling the KPI Report in a service. Then you would need to get the results into a text. And you should be able to send emails with this piece of code :
Things["PTC.FSU.CORE.Notification.Notification_TG"].SendMessage
({
"from": "someone@something.com",
"to": "someone@something.com",
"cc": "",
"bcc": "",
"subject": "Daily KPI report",
"body": "Put the results here"
});
Also, is there a guide under IoT Tips that explains how to create a email notification service? Looks like the search function is not finding anything there...
@cruz ,
Not sure what you are looking to locate. There is an Extension which can be installed and configured which will send email.
Once you have the extension installed and configured, it is simple to send an email from a service. Then the next part of your request is to create a service which is scheduled to run daily. This daily service will need to select the report and attach to the email and send.
Let me know if you have questions.
Regards
Pehowe
Hi Cruz.
You need 3 parts : the email engine configuration, a Scheduler to trigger it daily, and the subscription that will be called to prepare the email.
Part #1 : engine configuration. As Pehowe mentioned, there's an extension you can attach to Thingworx to help you with it. Even better news : RTPPM comes with one, so it should already be installed. However you may need to finish configuring it. See this link for more info on how to configure it. Notably, you will have to configure Thing PTC.FSU.CORE.Notification.Notification_TG which has the SendMessage service on it.
Part #2 : Scheduler. This should be simple, in Composer you can create a new Timer or Scheduler to trigger daily at the time you select. A Scheduler is probably better than a Timer for you in this case. Then on that new Scheduler, you can create the subscription that will listen to Me -> ScheduledEvent. The code will go there.
Part #3 : subscription. In the subscription, you will need to get the results of the KPIs and then call the SendMessage service. For the KPIs, you can look at HK's answer below, he's calling the KPI Report in a service. Then you would need to get the results into a text. And you should be able to send emails with this piece of code :
Things["PTC.FSU.CORE.Notification.Notification_TG"].SendMessage
({
"from": "someone@something.com",
"to": "someone@something.com",
"cc": "",
"bcc": "",
"subject": "Daily KPI report",
"body": "Put the results here"
});
Hi,
in RTPPM 2.0.3 the only way to show the KPI report mashup is through the UI interface. IF you want to retrieve the KPIs you could use service PTC.SCA.SCO.KPIEngineUtilsThing/Services/GetKPIValues_KEN instead:
The service takes a JSON input to specify the equipment and the time period
{
"Filters": [{
"FilterCriterias": [],
"EquipmentUID": 8
}],
"QuickTimeIntervalUID": 11,
"QuickTimeIntervalName": "LastWeek"
}
Greetings,
Holger