Page 1 of 2

Send Message using Notification service

PostPosted: Mon Feb 24, 2020 2:50 pm
by SBarnes
How can you send a message using Jiwa's notification service to a user, from inside a windows service?

Take for granted that Jiwa is logged on an a manager exists.

Re: Send Message using Notification service

PostPosted: Mon Feb 24, 2020 3:04 pm
by Scott.Pearce
Use the JiwaFinancials.Jiwa.JiwaToDos.ToDo business logic to construct and save a "ToDo" (i.e. set properties such as subject, message, assigned by, assigned to, etc.). Make sure that the ReminderSpecificDateTime property is set to now or in the past, and the ReminderType property is set to "Specific".

Saving this object puts an entry into TD_Main. Jiwa.exe polls this table for unread messages every n seconds where n is defined in the system setting System->ToDoPollInterval.

Re: Send Message using Notification service

PostPosted: Mon Feb 24, 2020 3:17 pm
by SBarnes
Ok that looks fairly easy, is there a way that you can put in a hyperlink to drill from the todo to a general journal set, sort of like linked documents or business objects?

I think I already know the answer is going to be no but I thought it was worth asking.

Re: Send Message using Notification service

PostPosted: Mon Feb 24, 2020 4:00 pm
by Scott.Pearce
The ToDo body is HTML, so you can insert text like:

Code: Select all
<A id=0000000008000000001B
href="jiwa:JiwaFinancials.Jiwa.JiwaJournalSetsUI.MainForm,0000000008000000001B">Journal
Set 100007</A>


into the body text. Use the ToDo Maintenance form to create links, then right click and "view source", then copy-paste the anchor tag.

Re: Send Message using Notification service

PostPosted: Mon Feb 24, 2020 5:42 pm
by SBarnes
Scott you are a genius, thanks.

Re: Send Message using Notification service

PostPosted: Tue Feb 25, 2020 7:01 pm
by SBarnes
Hi Scott

It goes in as a hyper line but when you click on it you get a message about web page can not be displayed, below is an example of what is being put in the body, any idea of what I am doing wrong?


<A id=b9071863d42b4a949e2d href = "jiwa:JiwaFinancials.Jiwa.JiwaJournalSetsUI.MainForm, b9071863d42b4a949e2d"> Journal Set 102657</A>

Re: Send Message using Notification service

PostPosted: Tue Feb 25, 2020 9:11 pm
by Mike.Sheen
Hi Stuart,

The experience you get with this depends on which version of Jiwa you are using.

In 7.2.1 we changed the way of drilling down to TODO links - we used to use what's known as an asynchronous pluggable protocol (aka shell links) - which just meant that when you installed Jiwa, we added a registry entry such that links starting with jiwa: would be recognised by browsers and invoke Jiwa.exe with the URL information and launch Jiwa.exe, passing in the URL as an argument and Jiwa.exe would look to see if another Jiwa.exe was running and if so, invoke a method via a socket which knew what to do with the URL.

This had many shortcomings (like what if Jiwa was running, but connected to a different database - see DEV-7189), so we decided to remove that way of drilling down in DEV-7611 as part of 7.2.1. We now don't rely on the asynchronous pluggable protocol (shell link) and instead parse the URL ourselves and load up the form just like you would normally do within Jiwa.

I think what might be happening for you is your system still has the registry entries we wanted to remove which handle drilling down using a shell link.

Can you check to see if you still have the registry entries described in DEV-7611 ? If you do still have them, remove them and try again - if that works then we obviously failed to remove those registry entries as we intended, and you should log an issue for that. If it still doesn't work, then we'll need to know where the hyperlink is failing (there are a few places which handle TODO links - is it the TODO desktop notification, listing form or TODO maintenance form) and with that information we can test and try to repro the issue.

Re: Send Message using Notification service

PostPosted: Tue Feb 25, 2020 9:40 pm
by Mike.Sheen
After inspecting the code, I think we messed up here.

The links work when clicked on the TODO listing form, but not the TODO maintenance form. The new drill-down logic (handling the NavigatingTo event of the web browser control) doesn't seem to be present in the todo maintenance form.

I cannot look at this right now or tomorrow - I'm currently helping a customer with some emergency disaster recovery work - perhaps Scott (he'll see this tomorrow) can take over.

Re: Send Message using Notification service

PostPosted: Tue Feb 25, 2020 9:50 pm
by SBarnes
Looks like the registry entries aren't there.

By the way I've also reported a bug https://service.jiwa.com.au/servicedesk ... /JIWA-5879 I discovered basically you can't delete a pending journal with a note attached as you get a foreign key violation.

Do you you think this the hyperlink is solvable with a plugin, as I'd be willing to have a go if you point me to where to look at how it works in the to do list screen?

Re: Send Message using Notification service

PostPosted: Tue Feb 25, 2020 9:58 pm
by Mike.Sheen
SBarnes wrote:Looks like the registry entries aren't there.
Do you you think this the hyperlink is solvable with a plugin, as I'd be willing to have a go if you point me to where to look at how it works in the to do list screen?


Our handler which works looks like this:

Code: Select all
Private Sub WebBrowser_Navigating(sender As Object, e As WebBrowserNavigatingEventArgs)
   If e.Url.ToString().StartsWith("jiwa:") Then
      e.Cancel = True
      Dim urlComponents As String() = e.Url.ToString().Split(",")
      Dim jiwaForm As JiwaApplication.IJiwaForm = Manager.FormFactory.CreateForm(Strings.Mid(urlComponents(0), 6))
      jiwaForm.DrillDownID = urlComponents(1)
      jiwaForm.Start()
   End If
End Sub


In the Todo maintenance form, the control is named ExtendedWebBrowser1 - so in theory adding a handler to ExtendedWebBrowser1.Navigating would do what you need.


SBarnes wrote:By the way I've also reported a bug https://service.jiwa.com.au/servicedesk ... /JIWA-5879 I discovered basically you can't delete a pending journal with a note attached as you get a foreign key violation.


That's not currently in our queue - waiting on support to triage and I am unable to intervene presently. That was only lodged at 7:06pm today, and I've already mentioned I'm tied up helping a customer with an emergency - so I need to leave that to the rest of the team to deal with - I'm sure they'll get back to you soon.