You need to sign in to do that
Don't have an account?
Saravanan @Creation
Creating newsobject based on record id
Hi All,
I want to create sobject instance record id. If any on know please help me
for(sobject rcd: sobjectRecordList)
{
sObject obj = Schema.getGlobalDescribe().get(rcd.id).newsObject();
}
sobjectRecordList is a collection of recods with different type.
Thanks,
I want to create sobject instance record id. If any on know please help me
for(sobject rcd: sobjectRecordList)
{
sObject obj = Schema.getGlobalDescribe().get(rcd.id).newsObject();
}
sobjectRecordList is a collection of recods with different type.
Thanks,
It is not very clear what you are trying to do here. Can you please explain so that I can suggest something?
Thanks,
Shashank
I want to create an sobject instance based on record id. In my below code I am running with the for lop
list of record with different type.
Assume 'sobjectRecordList' contains records of 'Account', 'Contact', 'Cases' etc.Now I want to create
intace base on type of records inside the for loop.
list<sobject> sobjectRecordList=new list<sobject>();
for(sobject rcd: sobjectRecordList)
{
sObject obj = Schema.getGlobalDescribe().get(rcd.id).newsObject();
}
Hope my explanation is clear to you.
Check this
If this solves your problem, kindly mark it as the best answer.
Hit Like, if it saved your work :-)
Regards,
Magulan
http://www.infallibletechie.com
Please try something like this:
for(sobject rcd: sobjectRecordList)
{
sObject obj = rcd.getSObjectType().newSObject(rcd);
}
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank