+ Start a Discussion
nayana pawar 3nayana pawar 3 

How to get previously added record

Hello,
I have created one VF page that shows last added record in edit mode But in that page i also have Previous button when
I click on this button I want record which is previously added by me IN EDIT MODE. I tried different logics but It's not working.
I also have next button in that VF page.
Please help me to write code and SOQL query so that I fetch record.
Gaurav NirwalGaurav Nirwal
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
Gaurav NirwalGaurav Nirwal
SELECT
rownum = ROW_NUMBER() OVER (ORDER BY p.BusinessEntityID),
p.FirstName
FROM Person.Person p
)
SELECT
prev.FirstName PreviousValue,
CTE.FirstName,
nex.FirstName NextValue
FROM CTE
LEFT JOIN CTE prev ON prev.rownum = CTE.rownum - 1
LEFT JOIN CTE nex ON nex.rownum = CTE.rownum + 1

nayana pawar 3nayana pawar 3
Thank you for replay But It is not helpful. Please read my question again any please give me reply.