function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raghu Rao 6Raghu Rao 6 

Not able to initate a Visual Flow from Custom List Button using OnClick Javascript

Hi
I am trying to initiate a Visual Flow from a standard list view custom button and pass the selected Record Id as an input parameter. This is not a URL but a OnClick Javascript. I am able to initiate the flow but the flow is not able to capture the parameter being passed to it. Code below for reference. Would appreciate if someone has faced similar issue.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
function getBaseURL() {
var url = location.href; // entire url including querystring - also: window.location.href;
var baseURL = url.substring(0, url.indexOf('/', 14));


if (baseURL.indexOf('http://localhost') != -1) {
// Base Url for localhost
var url = location.href; // window.location.href;
var pathname = location.pathname; // window.location.pathname;
var index1 = url.indexOf(pathname);
var index2 = url.indexOf("/", index1 + 1);
var baseLocalUrl = url.substr(0, index2);

return baseLocalUrl + "/";
}
else {
// Root Url for domain name
return baseURL + "/";
}

}

var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.Application__c)};
var applId=records[0];

var baseUrl = getBaseURL();

var uriToOpen = baseUrl+encodeURI('flow/RSDCreateReview?appID='+applId+'\&'+'retURL=/a0m?fcf=00Br0000000LWqU');

if (records[0] == null) {
alert("Please select at least one Application to Review.");
} else if (records[1] != null) {
alert("You have selected more than one Application record. This will work only on the first Application record selected.");
window.open(uriToOpen );
} else
{

window.open(uriToOpen );
}