You need to sign in to do that
Don't have an account?

Insert and Update on Same Button on VF page
Hi all,
I have one Custom Object Patient__c.On VF page onclick of commandlink button I am filling all the correspondant fields of Patient like firstname, middle name like that. I am getting the particular id also. Now my requirment is this to insert the new patient if we did not get the id from SQL query else update the patient if we got the id. Suppose the variable name in which I am getting the id is PatientID on Apex page
Please tell me I got stuck here ??
Regards
Raman
Try this
Hi Ashish Thanks for reply.
I have one question by this statement "Select id From Patient__c" we will get all the ids of Patient__c which are available , I guess we can not upsert all patient in one shot. Please try to understand my requirment again.
I am geetting the id of particular patient onclick of one button now my requirment is to compare this id with all the available ids of patient, if id exist than update the record
else insert the record.
Suppose the variable i got is patientid
if (patientid == select ids from patient)
update
else
insert;
like that
Thanks in advance, I am wating for ur reply !!
Regards
Raman
sory I just forgot to add condition
If this helps you please mark it as solved and give kudos