Create a List View Custom button and use this code to pass parameters to the flow.
Flow parameters:
vSelectedCaseIds which contains case ids collection which can be found from {!GETRECORDIDS($ObjectType.Case)}
.
vCaseCount which contains number of selected case id count.
retURL where it will be landed after completion.
{!RequireScript("/soap/ajax/29.0/connection.js")}
var caseObj = new sforce.SObject("Case");
var selectedCases = {!GETRECORDIDS($ObjectType.Case)}; //chosen records from list view checkboxes
//check at-least one record is selected
if (selectedCases[0] == null) {
alert("You must select at least one record");
} else
{
var serverUrl = '{!$Api.Partner_Server_URL_260}';
var position = {!FIND( '/services', $Api.Partner_Server_URL_260)};
var base = serverUrl.substring(0,position-1);
var url = base +encodeURI('/flow/Update_Due_Date?vSelectedCaseIds=' + selectedCases + '&vCaseCount=' + selectedCases.length + '&retURL=/500/o');
window.open(url, '_self');
}
The complete flow will look like this:
Step by step process:
- Screen
- Decision - Check Case Counter size
- Assignment - Retrieve Single Case Id from param
caseIdFormula - LEFT({!vRemainingCaseIds}, 15)
- Assignment - Assign values to Case Object
Where varSObjectCase
is SObject input and output variable
- Assignment - Add All Case Objects
Where All_Case_Sobjects
is SObject Collection variable
- Assignment - Retrieve Remaining CaseIds
Remaining_CaseIds - Formula
TRIM(
RIGHT({!vRemainingCaseIds}, (LEN({!vRemainingCaseIds})-16))
)
- Decision - If Counter less than vCaseCount
- Fast Update
- Success