Rank: Advanced Member
Groups: Registered
Joined: 12/31/2019(UTC) Posts: 35  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
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Joined: 9/15/2014(UTC) Posts: 133  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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/31/2019(UTC) Posts: 35  Location: Missouri Thanks: 10 times
|
Originally Posted by: AFC  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.
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Joined: 9/15/2014(UTC) Posts: 133  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!?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/31/2019(UTC) Posts: 35  Location: Missouri Thanks: 10 times
|
Originally Posted by: AFC  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"?
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Joined: 9/15/2014(UTC) Posts: 133  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.
|
 1 user thanked AFC for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/31/2019(UTC) Posts: 35  Location: Missouri Thanks: 10 times
|
Originally Posted by: AFC  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".
|
|
|
|
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.