You need to sign in to do that
Don't have an account?
Hi Everyone How to insert a record in custom object
Hi
Everyone How to insert a record in custom object which is under in Contact Standard Object Lookup RelationShip Between them
Attendance__c lookup (Contact)
Thanks and Regards
neeraj Sharma
Everyone How to insert a record in custom object which is under in Contact Standard Object Lookup RelationShip Between them
Attendance__c lookup (Contact)
Thanks and Regards
neeraj Sharma
Try the following code:
This will create custom object records with Contact as parent.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
All Answers
Greetings to you!
- Replace CustomObjectName__c with your Custom Object Name.
- Lookup always takes the id of record from Object. So I gave contact id in Attendance__c because it is a lookup of contact.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Little Bit changes the Contact Records is a Community User when i login in community as a contact after that insert the record so
SELECT Id,Name FROM Contact LIMIT 1 this query insert only particular contact so please suggest for all contacts
Thanks
Neeraj sharma
Greetings to you!
- Replace Custom ObjectName__c with your Custom Object Name.
- Lookup always takes the id of record from Object. So I gave contact id in Attendance__c because it is a lookup of contact.
List<Contact> conObj = [SELECT Id,Name FROM Contact];
List<ObjectName__c> allRecords = new LList<ObjectName__c>();
foreach(Contact cnn:conObj ){
ustomObjectName__c customObj = new CustomObjectName__c();
customObj.Name='Test Record';
customObj.Attendance__c = cnn.Id;
allRecords.add(customObj );
}
insert allRecords;
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Greetings to you!
- Okay, Please use the below code for more than one contact.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Try the following code:
This will create custom object records with Contact as parent.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com