You need to sign in to do that
Don't have an account?
Susanta Chakraborty
How to use urlfor function
How to use Urlfor function in the existing code
/apex/SDOC__SDCreate1?id={!Staff__c.Id}&Object=Staff__c
/apex/SDOC__SDCreate1?id={!Staff__c.Id}&Object=Staff__c
Hope below link will help you.
https://salesforce.stackexchange.com/questions/24506/using-urlfor-to-refer-to-the-current-page-dynamically
Thanks,
VinayKumar
Thanks for prompt reply but it didn't work. I am mentioning the VF page coding it will help you for further suggesstion
<apex:page controller="SDOC.SDCreateController" tabStyle="SDOC__SDTemplate__c" standardstylesheets="true" sidebar="{!sidebar}" action="{!initStep1}" title="{!tm['Generate Documents']}" lightningStylesheets="true"> <!-- ================ START LIGHTNING_REDIRECT_PANEL ================ --> <apex:outputPanel id="lightning_redirect_panel"> <script> if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) { if ('{!doLightningRedirect}' === 'true') { sforce.one.navigateToURL('{!lightningRedirectURL}', true); } } </script> </apex:outputPanel> <!-- ================= END LIGHTNING_REDIRECT_PANEL ================= --> <!-- Must be included to use sforce.console.isInConsole() --> <!-- Use version 30.0; isInConsole() doesn't work on version 40.0 --> <apex:includeScript value="/support/console/30.0/integration.js"/> <script type="text/javascript"> // Hide Salesforce header if showheader=false is included in URL var hideHeader = function() { var salesforceHeader = document.getElementById('AppBodyHeader'); if (salesforceHeader !== null) { salesforceHeader.style.display = 'none'; } } var showHeader = '{!JSENCODE($CurrentPage.parameters.showHeader)}'; if (showHeader === 'false' || showHeader === '0') { hideHeader(); } // End "Hide Salesforce header if showheader=false is included in URL" // Hide Salesforce header if user is invoking S-Docs from Sales Console. // This is finnicky as there are reported bugs with sforce.console.isInConsole(); // if this is the case, have the user include &showHeader=false in their S-Docs button. if (sforce.console.isInConsole()) { hideHeader(); } var AgreementForm = document.getElementById("blur"); var ContainerElem = document.getElementById("StatusBox"); AlignToCenter(ContainerElem); function AlignToCenter(Element) { var availableHeight = 0; var availableWidth = 0; if (Element.ownerDocument) { var docElement = Element.ownerDocument.documentElement; availableHeight = parseInt(docElement.clientHeight); if (availableHeight == "NaN") availableHeight = 0; availableWidth = parseInt(docElement.clientWidth); if (availableWidth == "NaN") availableWidth = 0; } if (availableHeight == 0 || availableHeight == "NaN") availableHeight = window.screen.availHeight - 200; if (availableWidth == 0 || availableWidth == "NaN") availableWidth = window.screen.availWidth - 100; var msgBoxTop = parseInt((availableHeight - parseInt(Element.clientHeight))/2); var msgBoxleft = parseInt((availableWidth - parseInt(Element.style.width))/2); if (msgBoxTop == "NaN" || msgBoxTop == 0) msgBoxTop = 100; Element.style.left = msgBoxleft + "px"; Element.style.top = msgBoxTop + window.pageYOffset + "px"; } function reposition(){ if(navigator.appName == 'Window Internet Explorer') AgreementForm.style.top = document.body.scrollTop; else AgreementForm.style.top = window.pageYOffset+"px"; //AlignToCenter(ContainerElem); } </script> <apex:actionStatus id="statLoad"> <apex:facet name="start"> <div id="blur" style="position:absolute; left:1px; top:1px; width:100%; height:100%; text-align:center; vertical-align: middle; background-color: #dcdcdc; opacity:0.7;filter:alpha(opacity=70)"> </div> <div id="StatusBox" style="position:absolute; left:50%; top:300px; width: 120px; height:50px; opacity:1;filter:alpha(opacity=100)"> <table border="1" cellpadding="0" cellspacing="0" style="border-left-color: #336699; border-bottom-color: #336699; width: 120px; border-top-color: #336699; height:50px; border-right-color:#336699; background-color:#ffffff;"> <tr> <td align="left" valign="top"> <table border="0" cellpadding="4" cellspacing="0" style="width: 100%; height: 100%"> <tr> <td style="border-bottom-color:#336699; border-bottom-width:0px; border-bottom-style:solid;vertical-align:middle;"> <img src="{!URLFOR($Resource.SDoc,'spinner_large.gif')}"/></td> <td style="border-bottom-color:#336699; border-bottom-width:0px; border-bottom-style:solid;vertical-align:middle;color:darkred;font-size:11pt;font-weight:bold;"> {!tm['Loading']}...</td> </tr> </table> </td> </tr> </table> </div> </apex:facet> </apex:actionStatus> <apex:sectionHeader title="{!tm['Create S-Docs']}" subtitle="{!tm['Generate Documents']}"/> <apex:form > <script type="text/javascript"> function doSearch() { searchServer( document.getElementById("{!$Component.searchText2}").value, document.getElementById("{!$Component.searchcategories}").options[document.getElementById("{!$Component.searchcategories}").selectedIndex].value ); } </script> <apex:actionFunction name="searchServer" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"> <apex:param name="txtValue" value=""/> </apex:actionFunction> <apex:pageMessages /> <apex:outputPanel id="backnav" rendered="{!$User.UIThemeDisplayed !='Theme4t'}"> <span class="style6"><<</span> <apex:commandLink action="{!returnToObj}" value="{!tm['Back']}"/> </apex:outputPanel> <br></br><br></br> <apex:panelGroup > <apex:outputLabel for="searchcategories">{!tm['Search in']} </apex:outputLabel> <apex:selectList id="searchcategories" size="1" value="{!docCategory}"> <apex:selectOptions value="{!docCategories}"/> <apex:actionSupport event="onchange" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"/> </apex:selectList> <apex:outputLabel for="searchText2"> {!tm['for :']} </apex:outputLabel> <apex:inputText id="searchText2" value="{!searchText2}" onkeyup="doSearch();"/> <apex:commandButton value="{!tm['Search']}" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"> <apex:param name="txtValue" value="{!searchText2}"/> </apex:commandButton> <apex:actionStatus id="panel3gStatus"> <apex:facet name="start"> <img src="{!URLFOR($Resource.SDoc,'spinner.gif')}" /> {!tm['Searching...']} </apex:facet> </apex:actionStatus> </apex:panelGroup> <br/> <br/> <apex:panelGroup rendered="{!JSENCODE($CurrentPage.parameters.AFPicklist) != 'false'}"> <apex:dataTable value="{!filterOptionsList}" var="filter"> <apex:column > <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'PICKLIST'}"> <apex:outputLabel for="filterCategoriesPicklist"> Filter on <b>{!filter.label}</b> for : </apex:outputLabel> </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'MULTIPICKLIST'}"> <apex:outputLabel for="filterCategoriesMultiPicklist"> Filter on <b>{!filter.label}</b> for : </apex:outputLabel> </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'BOOLEAN'}"> <apex:outputLabel for="filterCategoriesBool"> Filter on <b>{!filter.label}</b> for : </apex:outputLabel> </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'STRING' || filter.fieldType == 'TEXTAREA'}"> <apex:outputLabel for="filterCategoriesString"> Filter on <b>{!filter.label}</b> for : </apex:outputLabel> </apex:outputPanel> </apex:column> <apex:column > <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'PICKLIST'}"> <apex:selectList id="filterCategoriesPicklist" size="1" value="{!filter.filterOption}"> <apex:selectOptions value="{!filter.possibleOptions}"/> <apex:actionSupport event="onchange" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"/> </apex:selectList> <apex:actionStatus id="panel3gfilterPLStatus"> <apex:facet name="start"> <img src="{!URLFOR($Resource.SDoc,'spinner.gif')}" /> {!tm['Searching...']} </apex:facet> </apex:actionStatus> </apex:outputPanel> <apex:outputPanel layout="block" rendered="{!filter.fieldType == 'MULTIPICKLIST'}"> <apex:selectList id="filterCategoriesMultipicklist" value="{!filter.filterOptionList}" multiselect="true" size="{!IF(filter.possibleOptions.size > 5, 5, filter.possibleOptions.size)}" style="width:130px;"> <apex:selectOptions value="{!filter.possibleOptions}"/> <apex:actionSupport event="onchange" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"/> </apex:selectList> <apex:actionStatus id="panel3gfilterMPLStatus"> <apex:facet name="start"> <img src="{!URLFOR($Resource.SDoc,'spinner.gif')}" /> {!tm['Searching...']} </apex:facet> </apex:actionStatus> </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'BOOLEAN'}"> <apex:selectList id="filterCategoriesBool" size="1" value="{!filter.filterOption}"> <apex:selectOptions value="{!filter.possibleOptions}"/> <apex:actionSupport event="onchange" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"/> </apex:selectList> <apex:actionStatus id="panel3gfilterBStatus"> <apex:facet name="start"> <img src="{!URLFOR($Resource.SDoc,'spinner.gif')}" /> {!tm['Searching...']} </apex:facet> </apex:actionStatus> </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!filter.fieldType == 'STRING' || filter.fieldType == 'TEXTAREA'}"> <apex:inputText id="filterCategoriesString" value="{!filter.filterOption}"> <apex:actionSupport event="onkeyup" action="{!initStep1}" rerender="panel3g" status="panel3gStatus"/> </apex:inputText> <apex:actionStatus id="panel3gfilterSStatus"> <apex:facet name="start"> <img src="{!URLFOR($Resource.SDoc,'spinner.gif')}" /> {!tm['Searching...']} </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:column> </apex:dataTable> </apex:panelGroup> <br></br><br></br> <apex:pageBlock title="{!selectDocsClickNxtStep}"> <table width="100%"> <tr valign="top"> <td> <apex:pageBlockSection columns="1" collapsible="false"> <apex:pageBlockSectionItem > <apex:panelGroup id="panel3g"> <apex:outputText > <img src="{!URLFOR($Resource.SDoc,'checkbox_arrow.png')}" /> <apex:commandButton action="{!step2}" value="{!btnTxtStep2}" styleClass="btn" rendered="{!NOT(lightningNav)}" /> <apex:commandButton action="{!step2}" value="{!btnTxtStep2}" styleClass="btn" rendered="{!lightningNav}" reRender="lightning_redirect_panel" /> </apex:outputText> <apex:outputpanel style="overflow:scroll;height:250px;" layout="block"> <apex:pageBlockTable value="{!docsList}" var="c" rendered="{!NOT(ISNULL(docsList))}"> <apex:column width="25px"> <apex:inputCheckbox value="{!c.checked}"> <apex:actionsupport event="onclick" action="{!addDoc}" rerender="panel4g" status="statLoad" /> </apex:inputCheckbox> </apex:column> <apex:column headerValue="{!tm['Name']}"><img src='{!c.formatIconImgSrc}' border='0' /> <apex:outputText value="{!c.t.Name}"/></apex:column> <apex:column width="32px"> <!-- Container if e-vender value = s-sign --> <apex:outputPanel rendered="{!c.t.SDOC__E_Sign_Vendor__c == 'SSIGN'}"> <b><img width="32" src="{!URLFOR($Resource.SDoc,'s-sign_logo.png')}" /></b> </apex:outputPanel> </apex:column> <apex:column width="32px"> <!-- Container if allow edit value = true --> <apex:outputPanel rendered="{!c.t.SDOC__Allow_Edit__c}"> <b><img src='/img/icon/custom51_100/pencil16.png' alt='Edit' border='0'/></b> </apex:outputPanel> </apex:column> <apex:column value="{!c.t.SDOC__Description__c}" headerValue="{!tm['Description']}"/> <apex:column value="{!c.t[additionalFields[0]]}" headerValue="{!additionalFieldsLabels[0]}" rendered="{!(numberOfAdditionalFields > 0)}"/> <apex:column value="{!c.t[additionalFields[1]]}" headerValue="{!additionalFieldsLabels[1]}" rendered="{!(numberOfAdditionalFields > 1)}"/> <apex:column value="{!c.t[additionalFields[2]]}" headerValue="{!additionalFieldsLabels[2]}" rendered="{!(numberOfAdditionalFields > 2)}"/> <apex:column value="{!c.t[additionalFields[3]]}" headerValue="{!additionalFieldsLabels[3]}" rendered="{!(numberOfAdditionalFields > 3)}"/> <apex:column value="{!c.t[additionalFields[4]]}" headerValue="{!additionalFieldsLabels[4]}" rendered="{!(numberOfAdditionalFields > 4)}"/> </apex:pageBlockTable> </apex:outputpanel> <apex:outputText rendered="{!recordCount>99}"> <b>[More Available - Use Search criteria to limit results]</b> </apex:outputText> </apex:panelGroup> </apex:pageBlockSectionItem> </apex:pageBlockSection> </td><td></td> <td> <apex:panelGroup id="panel4g"> <apex:pageBlockSection title="{!tm['Selected Documents']}" columns="1" collapsible="false" rendered="{!hasSelectedDocs}"> <apex:pageBlockSectionItem > <apex:pageBlockTable value="{!selectedDocs}" var="ca" columnsWidth="50px, *" cellpadding="0" cellspacing="0"> <apex:column headerValue="{!tm['Remove']}"> <apex:commandLink value="X" action="{!removeDoc}" styleClass="btn" rerender="panel4g, panel3g" status="panel4Status"> <apex:Param name="tid" value="{!ca.t.ID}" /> </apex:commandLink> </apex:column> <apex:column width="25px" headerValue="{!tm['Create Task']}"> <apex:inputCheckbox value="{!ca.taskCreate}" rendered="{!ca.t.SDOC__Task_Auto_Create__c}" disabled="{!ca.t.SDOC__Task_Auto_Create_Default__c=='Checked2'}"> <apex:actionsupport event="onclick" action="{!addDoc}" rerender="panel4g, panel3g" status="panel4Status" /> </apex:inputCheckbox> <apex:outputPanel rendered="{!ca.t.SDOC__Task_Auto_Create_Default__c=='Checked2'}"> <img src='/img/func_icons/util/lock12.gif'/> </apex:outputPanel> </apex:column> <apex:column headerValue="{!tm['Name']}"><img src='{!ca.formatIconImgSrc}' border='0' /> <apex:outputText value="{!ca.t.Name}"/></apex:column> </apex:pageBlockTable> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:panelGroup> <apex:actionStatus id="panel4Status"> <apex:facet name="start"> <img src="{!URLFOR($Resource.SDoc,'spinner.gif')}" /> {!tm['Updating...']} </apex:facet> </apex:actionStatus> </td> </tr> <tr> <td width="65%"></td> <td width="5%"></td> <td width="30%"></td> </tr> </table> <apex:commandButton action="{!step2}" value="{!btnTxtStep2}" styleClass="btn" rendered="{!NOT(lightningNav)}" /> <apex:commandButton action="{!step2}" value="{!btnTxtStep2}" styleClass="btn" rendered="{!lightningNav}" reRender="lightning_redirect_panel" /> </apex:pageBlock> </apex:form> </apex:page>
An unexpected error has occurred. Your solution provider has been notified. (SDOC)
I really can't understand what to do....