You need to sign in to do that
Don't have an account?
Shwetal Desai
Get newly Inserted Record Id
I have one controller for my VF Page.
m doing insert operation from controller...
using
insert myobject;
now i want to fetch and set RecordId which is generated from this insert statement into one variable ("newId") in controller.
how can i do this?
m doing insert operation from controller...
using
insert myobject;
now i want to fetch and set RecordId which is generated from this insert statement into one variable ("newId") in controller.
how can i do this?
Have you tried something like this:
Look here for the docs.
Regards,
Jon
I got the ID...
--------------------------
Thanks & Regards,
Shwetal Desai
i'm trying to pas the id of an attachment right after inserting the attachment using apex. I want to get the id of the new attachment and insert this new id to a custom field right on the parent id page of this new attachment. Could you share please?
Thanks on advanced!
now pass the 'posid' variable
Instead of insert command use Database.SaveResult array contains the Ids of all the inserted records.
Thanks.
Database.Result[] result=Database.insert(acc);
List<Id> a;
for(Database.Result r:result){
a.add(r.getId());
}