0

I want to do this:

Interface__c interface = [SELECT Name, Id, Field1, Field2, Field3 FROM Interface__c where Name LIKE :'name'];
insert interface;

And by the same record I mean record with the same one field (but it must have other fields too because they are required.

1

1 Answer 1

1

This is just if you trying a single record for multiple you need to a list and assign values.

Interface__c interface = [SELECT Name, Id, Field1, Field2, Field3 FROM Interface__c where Name LIKE :'name'];
Interface__c obj= new interface__c();
obj.filed1___c= interface.Field1__c;
obj.Name=interface.Name;
.
.
.
Insert obj;

Just note not to assign Id please.

OR

insert interface.deepClone();

Note: You can also use clone and deepclone

Clone with all fields

Clone vs DeepClone

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .