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

With Apex: Copy Records From One Object to Another Object
Hi friends,
I have a custom object 'MyFixOrder' which has 2 Record Types 'AccountMyOrder' and 'ContactMyOrder'.
I have another custom object 'MyPartOrder' which also has 2 Record Types 'AccountMyOrder' and 'ContactMyOrder'.
Fields for both Objects are Same.
- Name(Text)
- Date of Start(Date)
- Date of End(Date)
- Active(Checkbox)
- OrderType(Text)
Suppose I have two 2 records in 'MyFixOrder' object of 'AccountMyOrder' and 'ContactMyOrder' RecordType
then i have to copy those records in 'MyPartOrder' object with their record types.
Any help would be greatly appreciated.
I have a custom object 'MyFixOrder' which has 2 Record Types 'AccountMyOrder' and 'ContactMyOrder'.
I have another custom object 'MyPartOrder' which also has 2 Record Types 'AccountMyOrder' and 'ContactMyOrder'.
Fields for both Objects are Same.
- Name(Text)
- Date of Start(Date)
- Date of End(Date)
- Active(Checkbox)
- OrderType(Text)
Suppose I have two 2 records in 'MyFixOrder' object of 'AccountMyOrder' and 'ContactMyOrder' RecordType
then i have to copy those records in 'MyPartOrder' object with their record types.
Any help would be greatly appreciated.
Regards,
Ramakant
All Answers
Please execute Below code in Anonymous window: Steps To use Anonymous window : Open Developer Console --> Debug --> Open Execute Anonymous window --> Paste your code --> Execute.
Please let me know for any issue and mark as best answer if helped.
Regards,
Ramakant
you are right.
Thank You so much for the response.
but it is giving me error(System.NullPointerException: Attempt to de-reference a null object) at line number 10.
I think we are not getting the RecordType Name directly in a list 'fixOrderList'.
any other way or Anything else we can do to overcome this problem? that would be helpful for me.
Regards,
Ramakant
Thank You So Much
if I click the add button, it must go to the second custom object.
How can I do?
Please...
Hi rahul, can i get whole code for it i have get same requirement.