cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RTW
Level: Powered On

Capturing Parameters

Fair warning, this is more "PowerApps Adjacent" than anything to do with PowerApps, but I figure its worth a shot.

 

I have just deployed a tool to log issues that my organization's customers have been having with their orders. We manage orders through an SAP web app. There are 2 types of documents - "Orders" and "Purchase Orders."

The order is what the customer sees, and is catalouged by a 9 digit number. The order is made up of one or many purchase orders to various vendors and service providers. These are catalaouged by 8 digit numbers. The tool I created allows users to input either the PO or the order number, disposition the issues, and then I go in the backend and run the PO's and order numbers to get additional infomration, such as vendor and location.

 

My issue is that if a user makes a mistake typing in the number, then the trail goes cold and I can't get any additional information. I'm thinking that Parameters might be a quick and dirty fix for this issues. I could have some way to extract the PO or the order number into a parameter and navigate to the powerapp and pre-populate parts of the form.

I can see two ways to do this. The first would be some sort of browser extension. The user would highlight the PO or order number, right click and select an option that says "Log this PO" or "Log this Order Number" and then opens a new tab going to powerapps.com/[my app]?PO=########&ORD=#########

 

The second would be by the URL. The URL basically looks like this:

www.contoso.com/webapp/[document view]/[document number]

They always end with /[document number]. I could also make a bookmarklet that would take everything after the last /, and pass that through to PowerApps using a parameter.

 

The problem is I have no idea how to accomplish this or where to being looking. If you have any tutorials, or resources, let me know.

1 ACCEPTED SOLUTION

Accepted Solutions
RTW
Level: Powered On

Re: Capturing Parameters

@RandyHayes yes, I was aware of that, I just wasn't sure how to set it up to only pass the PO or order number, but then I realized I was overcomplicating things.

 

First, I set the OnStart property of the app to

 

Set(ParamVar , true)

Then I set the OnSuccess of the form to 

Set(ParamVar , false)

 

This way, after the form is submitted, the old information will disappear, making it less likely to submit an issue for the wrong order. The idea being the user might leave the tracker app open for next time.

 

 

I have 2 text input feilds, Order Number and PO, I set them to the following

 

Order.Default = If(ParamVar = true , If(IsNumeric(Right(Param("Document"),9))=true , Right(Param("Document"),9) , Parent.Default) , Parent.Default)

PO.Default = If(ParamVar = true , If(IsNumeric(Right(Param("Document"),9))=true , Parent.Default , Right(Param("Document"),8)) , Parent.Default)

 Finally, I created a bookmarklet, using some code from here, which looks like this.

javascript:(function(){location.href='[INSER POWERAPPS URL HERE]?Document='+encodeURIComponent(location.href);})();

So, the user is on a page, sees an issue, and clicks the applet. They go to the tracker page, and the entire URL is sent to PowerApps. Powerapps reads the last 9 characters. If that is a number, it puts it into the Order Number feild. If it is not, it then reads the last 8 characters. If that is a number, it puts it into the PO field. If neither are numbers, nothing is auto-populated, and the user will have to manually input the infomration.

 

Not perfect but it works!

2 REPLIES 2
Super User
Super User

Re: Capturing Parameters

@RTW 

You are aware that you can pass parameters to PowerApps...and then use the Param function to get the values.

 

Not sure if that is what you are looking for, but hope it helps.

RTW
Level: Powered On

Re: Capturing Parameters

@RandyHayes yes, I was aware of that, I just wasn't sure how to set it up to only pass the PO or order number, but then I realized I was overcomplicating things.

 

First, I set the OnStart property of the app to

 

Set(ParamVar , true)

Then I set the OnSuccess of the form to 

Set(ParamVar , false)

 

This way, after the form is submitted, the old information will disappear, making it less likely to submit an issue for the wrong order. The idea being the user might leave the tracker app open for next time.

 

 

I have 2 text input feilds, Order Number and PO, I set them to the following

 

Order.Default = If(ParamVar = true , If(IsNumeric(Right(Param("Document"),9))=true , Right(Param("Document"),9) , Parent.Default) , Parent.Default)

PO.Default = If(ParamVar = true , If(IsNumeric(Right(Param("Document"),9))=true , Parent.Default , Right(Param("Document"),8)) , Parent.Default)

 Finally, I created a bookmarklet, using some code from here, which looks like this.

javascript:(function(){location.href='[INSER POWERAPPS URL HERE]?Document='+encodeURIComponent(location.href);})();

So, the user is on a page, sees an issue, and clicks the applet. They go to the tracker page, and the entire URL is sent to PowerApps. Powerapps reads the last 9 characters. If that is a number, it puts it into the Order Number feild. If it is not, it then reads the last 8 characters. If that is a number, it puts it into the PO field. If neither are numbers, nothing is auto-populated, and the user will have to manually input the infomration.

 

Not perfect but it works!