+ Start a Discussion
Kimberley LockwoodKimberley Lockwood 

Cloning Custom Objects - clear Text Rich Fields

Hi Everyone,
Hoping you can help with something I am stuck on.
I have created a button to clone a custom object however I don't want the rich text boxes to clone over and want them to clear and be blank when I have cloned the object.
I have tried using the formula to leave the field blank..... 00N7E000000IJvf =
However this doesnt seem to blank out text fields - it is only working on my date/number fields
Any help would be amazing - thanks all!!
Dhriti Moulick 16Dhriti Moulick 16
Hi Kimberley,

   Can you please share me the code you have written in Clone button?

cheers,
Dhriti
Kimberley LockwoodKimberley Lockwood
This is the what I have so far:

https://cci.my.salesforce.com/{!Field_Accompaniment_Form__c.Id}
/e?clone=1&retURL=/{!Field_Accompaniment_Form__c.Id}
&00Nb000000A49xE=
&00Nb000000A49xF={!Field_Accompaniment_Form__c.Date__c}

This works and updates the date field but when I try the same kind of set up for blanking out text it doesn't work
Any suggestions would be great!
Thanks
Kim
 
Dhriti Moulick 16Dhriti Moulick 16
I would suggest you go ahead with custom coding. Create a VF page and Controller on click of clone button,

In Controller,inside constructor,query the fields you need make necessary  fields as null,then clone it either using deep clone or shallow clone.

Follow this code snippets:

Object o = [Select Id,field2 from object where Id =:ObjectId LIMIT 1];
o.Field2 = ' ';(make your text field as null)


inside you save method:
object o1 = new object(); //replace with your object name
o1 = o.clone(false,true,false,false);



let me know if you have any doubt.

Cheers,
Dhriti