Hi All,
The external url will have some parameters with the key val pair,once I hit the url ,it should redirect to the application with the refilled data in the form .
Ex pb=SE&pv=AP&px=Oxelös
The form fields are diff ,Ex Name ,city ,Area
so above pb,Pv pv px,to be mapped,
Any sample or suggestion,
Regards
Hi Preeti,
You can use this JavaScript in the OnReady event of your screen:
const params = new URLSearchParams(window.location.search);
const obj = {};
params.forEach((value, key) => { obj[key] = value; });
$parameters.AllParams = JSON.stringify(obj);
This will return all the keys and values from the URL as a JSON string. Then you can just deserialize it and map the values to your form variables.
Hope this helps!
@Preeti zade Create a list of structure with 2 attributes : Key, Value and assign the values OnInitialize, read the mapping table and assign values accordingly. This is useful when you have many parameters.
Hello,
Assuming the URL parameters have fixed names (they don't change between calls).
Add the URL parameters as input parameters on the screen with the same names.
If you are on a reactive/Mobile/ODC application
On the OnInitialize event of the screen, set the values of the variables bound to the inputs in the form to the values in the inputs.
If the form inputs are bound to an aggregate or data action output, instead of the OnInitialize, you can set the values on the respective OnAfterFetch.
if you are on traditional web
Use the Preparartion to set the values.
Cheers.
You can achieve this requirement in OutSystems by passing the values as URL parameters and reading them in the target screen. For example, if the external URL is pb=SE&pv=AP&px=Oxelös, you can capture these values using Input Parameters or the GetURLParameter() function in the screen’s OnInitialize event. After fetching the values, map them to the respective form fields such as Name, City, and Area. This way, when the URL is opened, the application automatically redirects to the form with prefilled data.
Hi ,
Can anyone please suggest without using javascript ,to decode url parameters
Hi,
Already suggested. :)
Just add input parameters to the screen the user is being redirected, with the same name and data type as the parameters that will come on the url.
You then can use different screen lifecycle events to set the values from those inputs into the variables bounded to the inputs.
Explanation:
When the user reaches the screen, the values on the parameters in the url are placed automatically on the screen input parameters, bases on their name.
The platform will take care of this to you. No need to do that manually.
If I remember well, in case you don't want to use input parameters in the screen, you can use an extension (forgot the name, think its httprequesthandler) and fetch the parameters in OutSystems, no need to use javascript.
Cheers
Thank you,
Same name can not be given as same form using for other sources.
Sorry, but that does not make sense to me...
Do you mean you already have input parameters in the Form Screen in the Reactive App with the same names as the parameters that you want to pass, but with different data type?
Because that is the only thing I think would prevent you from use input parameters in the Form reactive screen to receive the values from the URL.
If not, the only other elements that can have the same names and would clash are screen local variables and screen action inputs (both on the same screen) and both you could change.
So, I must be missing something here.
In any case, the other "easy" way of getting the values without input parameters is through the GetBookmarkableURL client action, that will return the URL as a string and you will have to parse the URL to find the parameters.
Hello @Preeti zade
I followed the messages here and I'm a little confused about your actual needs. However, something I could suggest, if you need even "security" in the passed parameters, is that I have a component on Forge: CryptoToken (https://www.outsystems.com/forge/component-overview/10181/cryptotoken-o11) which you can use to encrypt parameters and navigate between screens. As mentioned in your example, here you can embed more than one parameter, which can meet your needs and provide more security (anti-fraud and prevents alterations).
If it makes sense to you, this component is only in O11; if needed, I can build a version for ODC.
Feel free to explain a little more. We are here to help and collaborate!
Best regards,Edson Marques
It depends on how you're using the data.
If it's a local variable, you can handle reassignment in OnInit.
If the data type is a collection, you should check and reassign it in OnAfterFetch.