+ Start a Discussion
AnonTestQuestAnonTestQuest 

Copy a custom object using a trigger?

Hi,

I was curious how I could copy a custom object (the entire thing) it's a position opening in a company to other areas of salesforce using a trigger. For instance, if the job posting layout has a checkbox for 'post externally', how could I make a trigger that would, if that check box = true, post the entire job posting to the internal job postings page? I'm attempting to make it so if someone were to check off that they want an opening posted externally, it will automatically, also post it internally. Is there an easier way to do this than with a trigger?

Thanks for any help!
Andy BoettcherAndy Boettcher
Are you talking about copying a custom OBJECT or just a RECORD within the object?
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi AnonTestQuest,
If you are trying to copy a record of an object rather than the Object, then it is quite simple and easy.
Prosenjit Sarkar 7Prosenjit Sarkar 7
I think copying a custom object is not a good idea unless you got this requirement from client. otherwise a whole record can be cloned to a new record (of same sObject type). However, we can map fields and copy a record of one sObject to a record of another sObject. If you can elaborate your requirement, I can understand the scenario. 
Prosenjit Sarkar 7Prosenjit Sarkar 7
So, are you copying data from X object record to Y object record or X object record to to X object record ? I your scenario I think it is option no. 1. However, in both cases a trigger is sufficient to do the job.
Prosenjit Sarkar 7Prosenjit Sarkar 7
So, are you copying data from X object record to Y object record or X object record to to X object record ? I your scenario I think it is option no. 1. However, in both cases a trigger is sufficient to do the job.
PW9PW9
Ok, I have more information about this trigger. It would be written in Sublime. When an employee types in the job description to that specific (external) (text) field on the object, They want it to also post the text to the internal job description text area as well when they post it. This is attempting to aleviate the copy and pasting of test with a trigger. So in more basic terms, I want to write a trigger in Sublime to copy text out of a custom rich text field and into another custom rich text field on the same custom object when it is posted.