Support Forum

Ask questions and get help from MobileTogether experts.
MobileTogether Product Information
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Philip Michael  
#1 Posted : Monday, September 14, 2020 3:40:07 PM(UTC)
Philip Michael

Rank: Advanced Member

Groups: Registered
Joined: 12/31/2019(UTC)
Posts: 35
United States
Location: Missouri

Thanks: 10 times
I want to use the value from the payload of a Push Notification. How do I do this? I want to set a page source element to the value of a payload.

Example: From the OnPageLoad of the "Solution to start" I will Update Node(s) $PERSISTENT/Root/@SomeElement = $MT_PUSHNOTIFICATION/Root/Entry/@value
AFC  
#2 Posted : Tuesday, September 15, 2020 7:02:25 AM(UTC)
AFC

Rank: Administration

Groups: Registered, Administrators
Joined: 9/15/2014(UTC)
Posts: 133
Austria

Was thanked: 18 time(s) in 18 post(s)
There is a seperate OnPushNotificationReceived action tree, which is called, when a push notification is received.
Here you can update your node from the $MT_PUSHNOTIFICATION tree - also see here.
Philip Michael  
#3 Posted : Tuesday, September 15, 2020 1:07:09 PM(UTC)
Philip Michael

Rank: Advanced Member

Groups: Registered
Joined: 12/31/2019(UTC)
Posts: 35
United States
Location: Missouri

Thanks: 10 times
Originally Posted by: AFC Go to Quoted Post
There is a seperate OnPushNotificationReceived action tree, which is called, when a push notification is received.
Here you can update your node from the $MT_PUSHNOTIFICATION tree - also see here.


Hi AFC,
Thanks for your reply, but as you can see from my post I am already aware of that tree. What I'm asking is how do I set a page source equal to one on that tree.
AFC  
#4 Posted : Wednesday, September 16, 2020 11:17:43 AM(UTC)
AFC

Rank: Administration

Groups: Registered, Administrators
Joined: 9/15/2014(UTC)
Posts: 133
Austria

Was thanked: 18 time(s) in 18 post(s)
Hi Philip!

In your first post, you already mentioned the "Update Node(s)" action, so I'm not quite sure what your problem is!?

First, you can also directly use the $MT_PUSHNOTIFICATION page source.
If you really want to copy it (for whatever reason), you can e.g. use the "Append Node(s)" action.
Quote:
Delete Node(s): $PERSISTENT/Root/Entry
Append Node(s):
to Node: $PERSISTENT/Root
new Node(s): $MT_PUSHNOTIFICATION/Root/Entry

this way, you remove possible existing "Entry" elements and get an exact copy of the new payload.

This you can do in the mentioned OnPushNotificationReceived action tree.

Does this help? Maybe it also makes sense you post a small sample here to see what does not work for you!?
Philip Michael  
#5 Posted : Wednesday, September 16, 2020 12:25:14 PM(UTC)
Philip Michael

Rank: Advanced Member

Groups: Registered
Joined: 12/31/2019(UTC)
Posts: 35
United States
Location: Missouri

Thanks: 10 times
Originally Posted by: AFC Go to Quoted Post
Hi Philip!

In your first post, you already mentioned the "Update Node(s)" action, so I'm not quite sure what your problem is!?

First, you can also directly use the $MT_PUSHNOTIFICATION page source.
If you really want to copy it (for whatever reason), you can e.g. use the "Append Node(s)" action.
Quote:
Delete Node(s): $PERSISTENT/Root/Entry
Append Node(s):
to Node: $PERSISTENT/Root
new Node(s): $MT_PUSHNOTIFICATION/Root/Entry

this way, you remove possible existing "Entry" elements and get an exact copy of the new payload.

This you can do in the mentioned OnPushNotificationReceived action tree.

Does this help? Maybe it also makes sense you post a small sample here to see what does not work for you!?


Hi AFC,

I have a Send Push Notification action which is set to start a different Solution with "Solution to Start" = Page X.
I also set the "Payload" in this Send Push Notification: key="Test", value=10.
On Page X, there is a MT_PUSHNOTIFICATION tree with ROOT/ENTRY/@key and ROOT/ENTRY/@value. On page load, I set a MessageBox with a message = either one of these values (ROOT/ENTRY/@key or ROOT/ENTRY/@value) just to see if there is anything in them and it is empty. How do I pull these values out? I'm assuming you can set multiple "key" and "value" combinations so how do I specify which one I need and get the "value"?
AFC  
#6 Posted : Wednesday, September 16, 2020 2:30:09 PM(UTC)
AFC

Rank: Administration

Groups: Registered, Administrators
Joined: 9/15/2014(UTC)
Posts: 133
Austria

Was thanked: 18 time(s) in 18 post(s)
Hi Philip!

As written in both of my answers, you should put your actions in the OnPushNotificationReceived action tree of the receiving solution - not in OnPageLoad!

Whenever a push notification is handled, these actions are executed.

Yes, you can set multiple key/value pairs.
If you do not want to handle all of them, but are interested in the value of a distinct key, you can use XPath expressions like:
Quote:
$MT_PUSHNOTIFICATION/Root/Entry[@key='Test']/@value

which would return '10' in your case.
thanks 1 user thanked AFC for this useful post.
Philip Michael on 9/16/2020(UTC)
Philip Michael  
#7 Posted : Wednesday, September 16, 2020 4:24:41 PM(UTC)
Philip Michael

Rank: Advanced Member

Groups: Registered
Joined: 12/31/2019(UTC)
Posts: 35
United States
Location: Missouri

Thanks: 10 times
Originally Posted by: AFC Go to Quoted Post
Hi Philip!

As written in both of my answers, you should put your actions in the OnPushNotificationReceived action tree of the receiving solution - not in OnPageLoad!

Whenever a push notification is handled, these actions are executed.

Yes, you can set multiple key/value pairs.
If you do not want to handle all of them, but are interested in the value of a distinct key, you can use XPath expressions like:
Quote:
$MT_PUSHNOTIFICATION/Root/Entry[@key='Test']/@value

which would return '10' in your case.


Thank you AFC. That last bit of code "$MT_PUSHNOTIFICATION/Root/Entry[@key='Test']/@value" is what I needed. I mis-typed about the "OnPageLoad" and meant "OnPushNotificationReceived".
Users browsing this topic
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.