You need to sign in to do that
Don't have an account?
Ashish Kumar Yadav
how can i redirect the vf page another vf page after selecting account lookup and click on continue button then my page redirect
Hi Team, Please help me i am facing the issue while redirecting the to another vf page . my requirement is after selecting account lookup click on continue button then redirect the page with account id in another vf page. VF Page ======== <apex:page controller="OrderAccountLookup" tabStyle="OrderAccountLookup__tab"> <apex:includeScript value="{!$Resource.Jquery_06_09_17}"/> <style> .txtfield{width:65px; margin-bottom:5px;} table.bgmpop{ border-collapse:collapse; border:1px solid #333; font-family:calibri; font-size:12px; } table.bgmpop th { border-collapse:collapse; background:#6B95A0; color:#fff; border-right:1px solid #fff; text-align:center; font-family:calibri; font-size:14px; padding:3px; border:1px solid #fff; } table.bgmpop td { color:#333; border:1px solid #ccc; font-family:calibri; font-size:12px; padding:3px; text-align:center; } </style> <script> function setContact(idc,val){ document.getElementById(idc).value=val.value; } </script> <apex:form id="frm" > <script> var accReq = "{!acc.Name}"; if(accReq != '') { window.location="/apex/VisualforceName?id={!acc.Id}"; } </script> <apex:pageMessages id="showmsg"></apex:pageMessages> <apex:inputHidden value="{!targetField}" id="selectedAccId"/> <div style="background:#A9B97A; border-radius:5px; padding:10px;" align="left"> <b><apex:outputText value="Please Select Account" style="color:#fff;font-size:20px; font-family:calibri;"/></b> </div> <div align="left" style="padding:10px 5px 10px 5px; border:1px solid #ccc;"> <apex:OutputLabel value="Account" style="color:#333;font-size:12px; font-weight:bold; padding-right:15px;" /> <c:AutoCompleteV2 allowClear="true" importJquery="true" labelField="Name" SObject="Account" valueField="Id" targetField="{!targetField}" style="width:200px"/> </div> <apex:repeat value="{!accountList}" var="acc" > </apex:repeat> <apex:commandButton value="Continue" action="{!ShowContacts}" reRender="frm" styleClass="ButtonStyle" style=" border:1px solid #cacaca; -webkit-border-radius: 4px; -moz-border-radius: 4px;border-radius: 4px; font-size:12px;font-family:arial, helvetica, sans-serif; margin-top:2px; padding:6px 8px 6px 8px; text-decoration:none; font-weight:bold; color: #333;" /> <apex:commandButton value="Cancel" action="{!Cancel}" styleClass="ButtonStyle" style=" border:1px solid #cacaca; -webkit-border-radius: 3px; -moz-border-radius: 3px;border-radius: 3px; font-size:12px;font-family:arial, helvetica, sans-serif; margin-top:2px; padding:6px 8px 6px 8px; text-decoration:none; font-weight:bold; color: #333;" /> <div style="padding:10px 8px 10px 8px;display:none" > </div> </apex:form> </apex:page> Apex class ============ public class OrderAccountLookup { public Account acc{get;set;} public String targetField {get;set;} public String busAssoID {get;set;} public String retURL {get;set;} public String conid {get;set;} public String message{get;set;} public List<Contact> contactList {get;set;} public List<Account> accountList {get;set;} public List<SelectOption> options {get;set;} public string bl1 {get;set;} public boolean contactsection {get;set;} public boolean desabl {get;set;} public String lkid{get;set;} public Account selectedAccount{get;set;} public OrderAccountLookup() { acc=new Account(); } ApexPages.standardController a_sc = null; public OrderAccountLookup(ApexPages.standardController sc) { bl1='display:none'; desabl = true; a_sc = sc; busAssoID = ApexPages.currentPage().getParameters().get('id'); retURL = ApexPages.currentPage().getParameters().get('retURL'); if(retURL != null){ retURL = retURL.substring(1,16); } targetField = ''; conid = ''; message = ''; contactList = new List<Contact>(); accountList = new List<Account>(); options = new List<SelectOption>(); if(busAssoID == null){ if(lkid!=null){ RecordType recordBA = [select id,Name from RecordType where SobjectType = 'Account']; acc.recordTypeID = recordBA.Id; }else{ selectedAccount = [select id,name from account]; ShowContacts(); Redirect(); } } } public void ShowContacts(){ message = ''; List<Account> tempAccList = [select Id,Name,OwnerID,Owner.name from Account where Id =: targetField]; if(tempAccList.size() == 0 ){ bl1='display:none'; if(targetField==''){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please search and select required account.')); } else{ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'This account doesnot exist, Please select proper account.')); } }else { bl1=''; accountList = [select Id,Name,OwnerID,Owner.name from Account where Id =: targetField]; contactList = [select Id,Name from Contact where AccountId =: targetField]; if(accountList.isEmpty()){ desabl = true; message='No Account to display'; } if(contactList.isEmpty()){ desabl = true; message='No Contacts to display'; } options = new List<SelectOption>(); for(Contact conObj: contactList){ options.add(new SelectOption(conObj.Id,'')); desabl = false; } } } public PageReference Redirect() { pagereference ref; if(acc.Id!=null){ ref = new PageReference('/apex/Orders_Custom_Page_HO'); ref.setRedirect(true); } return ref; } public pagereference cancel(){ pagereference ref; if(retURL!=null){ if(lkid!=null) { ref = new pagereference('/'+lkid); } } return ref; } }
public PageReference redirectToMyVF(Id accId) {
PageReference myVFPage = new PageReference('/apex/myVFPage')
myVFPage.setRedirect(true);
myVFPage.getParameters().put('myId', accId);
return myVFPage;
}
String userId = UserInfo.getUserId();
PageReference pageRef = new PageReference('/apex/OrderUploadPage_HO?id'+acc.Id);
pageRef.getParameters().put('UserId',userId);
pageRef.getParameters().put('accid',acc.Id);
pageRef.setRedirect(true);
return pageRef;
}
This code is redirecting me next vf page but i want to send account id in url but getting the user id only see below url while redirecting the page
.visualforce.com/apex/OrderUploadPage_HO?UserId=005o0000000LG4iAAG