You need to sign in to do that
Don't have an account?
get the id of the prior record that i want to update and return
hi
i have a problem, with a vfp
recently i created a custom object Aspirante__c
then in the interface of this object add anew button that send me to one vfp
in this page a will update a loockup field
but i don't know how to pass the id od the record that i want to delete
the way that link the button with the page is with
window.location.href = "/apex/MyCustomLookup" when i created the button and then add on the format page
another problem is that i want to return to the prior page exactly of the record after that i click the button save
actually this redirect me but not update
this is my code
public with sharing class MyCustomLookupController1 { public String nombre {get;set;} public String vacante {get; set;} public String vacantebusqueda{get;set;} public Aspirante__c aspirante1 {get;set;} public Vacante__c oVacante{get;set;} public MyCustomLookupController1() { aspirante1= new Aspirante__c(); } public void save() { //consulta objeto aspirante al que voy actualizar Aspirante__c aspirante2 = [Select id, Name, Vacante__c from Aspirante__c where Id='a04d0000001phczAAA' Limit 1];//i want to take the id of the record aspirante2.Vacante__c=aspirante1.Vacante__c; // aspirante2.Name=nombre; update aspirante2; } }
<apex:page controller="MyCustomLookupController1" id="Page" tabstyle="Contact"> <apex:sectionHeader title="Aspirante" subtitle="Asignar vacante" /> <apex:form id="myForm"> <apex:PageBlock id="PageBlock"> <apex:pageBlockSection columns="1" title="Asignar vacante"> <apex:inputField id="Vacante__c" value="{!aspirante1.Vacante__c}" /> <apex:commandButton action="{!save}" value="Guardar" onclick="history.go(-1);return false;"/> </apex:pageBlockSection> </apex:PageBlock> </apex:form> </apex:page>
I'm not sure if i had understood your problem correctly, but in case you are trying to deal with paramters then this link might help
http://www.forcetree.com/2009/06/passing-parameters-to-visualforce-page.html