Actually I wanted to pass a field value from the record page through the URL. But since It did not have any parameter i was wondering how. When I tried to append url by (?id=xyz), It was automatically refreshing the page and the appended part of url was removed.
I got a solution, I needed to include the namespace. Instead of appending (?id=xyz) I should be appending (?c__id=xyz) to the url. It worked.
Hi Saurav, You can simply use navigateToUrl without specifying any param. For prefill, you can use value={data}inside search box and define data as a variable in js like@track var zip = "Default value"
When I did as you said, It opens the page with the search box written "Default value". Here is my controller (From where I am naviagting to the LWC app page), doInit : function(component, event, helper) { var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "url": "https://myDomain/n/sample_Form" }); setTimeout(function(){ $A.get("e.force:closeQuickAction").fire(); },0.000001); urlEvent.fire(); }
In LWC controller
@track sVal='Default value'; in HTML file <input type="text" value={sVal} autofocus="autofocus" placeholder="Enter Name" autocomplete="on" minlength="1" onkeyup={handleKeyChange} />
Actually I wanted to pass a field value from the record page through the URL. But since It did not have any parameter i was wondering how. When I tried to append url by (?id=xyz), It was automatically refreshing the page and the appended part of url was removed.
I got a solution, I needed to include the namespace. Instead of appending (?id=xyz) I should be appending (?c__id=xyz) to the url. It worked.
Actually I wanted to pass a field value from the record page through the URL. But since It did not have any parameter i was wondering how.
When I tried to append url by (?id=xyz), It was automatically refreshing the page and the appended part of url was removed.
I got a solution, I needed to include the namespace. Instead of appending (?id=xyz) I should be appending (?c__id=xyz) to the url. It worked.
Thanks a lot.
All Answers
You can simply use navigateToUrl without specifying any param.
For prefill, you can use value={data} inside search box and define data as a variable in js like @track var zip = "Default value"
When I did as you said, It opens the page with the search box written "Default value".
Here is my controller (From where I am naviagting to the LWC app page),
doInit : function(component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "https://myDomain/n/sample_Form"
});
setTimeout(function(){
$A.get("e.force:closeQuickAction").fire();
},0.000001);
urlEvent.fire();
}
In LWC controller
@track sVal='Default value';
in HTML file
<input type="text"
value={sVal}
autofocus="autofocus"
placeholder="Enter Name"
autocomplete="on"
minlength="1"
onkeyup={handleKeyChange}
/>
this is what you had expected, right?
Actually I wanted to pass a field value from the record page through the URL. But since It did not have any parameter i was wondering how.
When I tried to append url by (?id=xyz), It was automatically refreshing the page and the appended part of url was removed.
I got a solution, I needed to include the namespace. Instead of appending (?id=xyz) I should be appending (?c__id=xyz) to the url. It worked.
Thanks a lot.