Salesforce flow does not support two column page layout in flow, please vote this idea if you want it as out of box functionality.
However, using below solution we can convert single column page layout to double column layout in flow.
We need to embed flow in below Visualforce. Not necessarily you need to have a knowledge of Visualforce code, simply copy paste in your Salesforce organization and replace flow name with your flow name in your organization. This Visualforce page uses JQuery library to manipulate DOM element. Please download latest version of JQuery and save it as static resource with name “JQuery2_1_4” or you can also update static resource name in below code.
You can use variable “ignoreTableRows” to add row numbers or field sequence which you don’t want to covert as two column. I have added as much as comment to make code self explanatory.
Visualforce page:
<!-- Author : Jitendra Zaa Description : Below Visualforce page converts single column flow to double column layout --> <apex:page > <!-- Enter your flow name below --> <flow:interview name="Two_column_flow" finishLocation="/{!$CurrentPage.parameters.id}"> <apex:param name="varFlowVar" value="{!$CurrentPage.parameters.id}"/> </flow:interview> <apex:includeScript value="{!$Resource.JQuery2_1_4}"/> <script> //row number of fields which should be rendered as single column, index starts with 0. var ignoreTableRows = [0,1,6]; function isValidRow(rowIndex){ for(var j = 0; j< ignoreTableRows.length; j++) { if(rowIndex == ignoreTableRows[j]) return false; } return true; } $(function() { var tableRowCounter = 0; var tbl = $('table .detailList'); var rows = $('tr', tbl); var i = 0; for(i = 0; i<rows.length;i++){ if(isValidRow(i)) { var currentRow = $('tr:eq('+i+')', tbl); var nextRowIndex = i+1; //check if next row is valid if(!isValidRow(nextRowIndex)) { while(!isValidRow(nextRowIndex)) { nextRowIndex = nextRowIndex +1; if(nextRowIndex >= rows.length) break; } } var nextRow = $('tr:eq('+nextRowIndex+')', tbl); if(nextRow) { var currentColumns = $('td', currentRow); var nextRowColumns = $('td', nextRow); if(currentColumns[2] && currentColumns[3]) { //remove 3rd and 4th column $(currentColumns[2]).remove(); $(currentColumns[3]).remove(); $(nextRowColumns[0]).detach().appendTo(currentRow); $(nextRowColumns[1]).detach().appendTo(currentRow); $(nextRow).remove(); } } } } }); </script> <style type="text/css"> .dataCol, .labelCol{ padding-top: 5px !important; padding-bottom: 5px !important; } </style> </apex:page>
Demo output :
Leave a Reply