You need to sign in to do that
Don't have an account?
Anjana Sharma 9
Dynamicaly insert parent record and then insert child records in that parent record
Hello everone ,
I dont understand that how can i get the object dynamically from object like , i have two arguments:-
1.Map<String,List<String>>: Key:Parent Object , Val: List of Child Object
2.Map<String, Map<String, String>>: Key: Object , Value = Key: Field, Value: Field Value
For example:
In argument i passsed
Account => new List<String>{Contact}
And in argument 2 i passed
Account => new Map<String, String>{Name => Test, website = test.com} Contact => new Map<String, String>{FirstName => Test, FirstName = Last name Test}
i want to insert account then insert all child objct records in that parent account
I dont understand that how can i get the object dynamically from object like , i have two arguments:-
1.Map<String,List<String>>: Key:Parent Object , Val: List of Child Object
2.Map<String, Map<String, String>>: Key: Object , Value = Key: Field, Value: Field Value
For example:
In argument i passsed
Account => new List<String>{Contact}
And in argument 2 i passed
Account => new Map<String, String>{Name => Test, website = test.com} Contact => new Map<String, String>{FirstName => Test, FirstName = Last name Test}
i want to insert account then insert all child objct records in that parent account
Hi Anjana,
Please refer this example and modify yours accordingly :-
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_foreign_keys.htm
Regards,
Priya Ranjan