How to pass string / number parameter with Deeplink/Universal link to Microflow
0
Hi, I am following https://community.mendix.com/link/questions/91914 to implement the functionality to open the hybrid app. My Requirement: Suppose i have an app with many products and each product has a productID. My deep link url is like <*/link/product?productID=12345asd> and my deeplink Microflow is like MyModule.MyProductMF i have used universal link(https://github.com/sudhansurana/cordova-universal-links-plugin) forked from https://github.com/flipflopapp/cordova-universal-links-plugin with minor fixes. my entry code looks like var MxApp = require("@mendix/mendix-hybrid-app-base"); MxApp.onConfigReady(function(config) { // Perform any custom operations on the dojoConfig object here // Perform any custom operations on the dojoConfig object here config.afterNavigationFn = function() { console.info("Running Eric's custom afterNavigation function"); //add a listener now for deep links //any time they come in now, we'll be ready to handle them universalLinks.subscribe(null, function(eventData) { // do some work console.log('Did launch application from the link: ' + eventData.url); var oReq = new XMLHttpRequest(); /* use a PUT to get responses from DL without redirects * 200 means it's ready * 401 means you're not logged in * 404 means not found */ oReq.open("put", eventData.url, true); console.log(mx.ui.getContentForm()); console.log(mx); debugger; //detect if iOS for handle deeplink if (device.platform === 'iOS' || device.platform === 'Android') { var pid = mx.ui.showProgress("Loading link..."); oReq.onreadystatechange = function () { if(oReq.readyState === 4) { if(oReq.status === 200) { mx.data.action({ params: { actionname: "MyModule.MyProductMF" }, origin: mx.ui.getContentForm(), callback: function() { mx.ui.hideProgress(pid); }, error: function(error) { mx.ui.hideProgress(pid); mx.ui.error("Unable to load link. Please try again."); } }); } else if (oReq.status === 401) { //we weren't redirected (got a 200) and instead were sent to a login page. Show an error mx.ui.hideProgress(pid); mx.ui.error("Sorry, you need to be logged in to view this link. Please log in and try again"); } else { //something else went wrong mx.ui.hideProgress(pid); mx.ui.error("Sorry, something went wrong with the link."); } } }; } oReq.send(); }); //these lines are from the original afterNavigationFn, which we're overriding /* * If defined, this function is invoked in onNavigation method, * called as the last action during the startup. Lines below handle * removal of the loading nodes. */ var removeSelf = function() { var appNode = document.getElementById("mx-app"); if (appNode) appNode.style.display = "none"; }; removeSelf(); } }); It is failing and showing the productID as null in microflow log sample log 6:50:28 PMAPPERRORClient: Error 6:50:28 PMAPPINFOat https://*.mxapps.io/mxclientsystem/mxui/mxui.js?636839359876716420:31:34254 6:50:28 PMAPPINFOat https://*.mxapps.io/mxclientsystem/mxui/mxui.js?636839359876716420:20:2053 6:50:28 PMAPPINFOat Object.next (https://*.mxapps.io/mxclientsystem/mxui/mxui.js?636839359876716420:20:2158) 6:50:28 PMAPPINFOat a (https://*.mxapps.io/mxclientsystem/mxui/mxui.js?636839359876716420:20:929) 6:51:09 PMAPPINFOClient: Running Eric's custom afterNavigation function 6:58:17 PMAPPERRORClient: No permission to read or write entity *.DeepLinkParam, check security! 6:58:17 PMAPPERRORClient: Could not commit object: 6:58:17 PMAPPINFOCannot read property 'needsReachableState' of undefined TypeError: Cannot read property 'needsReachableState' of undefined 6:58:17 PMAPPINFOat t.<anonymous> (https://*.mxapps.io/mxclientsystem/mxui/mxui.js?636839359876716420:67:112857) 6:58:17 PMAPPINFOat i (file:///android_asset/www/js/bundle.js:1:110486) 6:58:17 PMAPPINFOat Generator._invoke (file:///android_asset/www/js/bundle.js:1:111625) 6:58:17 PMAPPINFOat Generator.t.(anonymous function) [as next] (file:///android_asset/www/js/bundle.js:1:110665) 6:58:17 PMAPPINFOat i (file:///android_asset/www/js/bundle.js:1:110486) 6:58:17 PMAPPINFOat r (file:///android_asset/www/js/bundle.js:1:110721) 6:58:17 PMAPPINFOat file:///android_asset/www/js/bundle.js:1:111066 6:58:17 PMAPPINFOat new Promise (<anonymous>) 6:58:17 PMAPPINFOat e (file:///android_asset/www/js/bundle.js:1:111040) I also tried to create a MendixObject and on creation of it tried to pass it , but it shows security issue. I am logging in by Admin account. I have already tried the following discussions https://community.mendix.com/link/questions/8924 https://community.mendix.com/link/questions/8883 https://community.mendix.com/link/questions/87255 https://community.mendix.com/link/questions/9692 https://community.mendix.com/link/questions/92337 Please Help
asked
Sudhansu Sekhar Rana
1 answers
1
- add parameters in the URL like;
*/link/product?productID=12345asd¶mater1=asasa¶meter2=121….
-you need to setincludeparameters on true when creating a deeplink and add the parameters to the deeplink as paramater1.string and paramater2.number