function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VinuVinu 

Replace a single value from a group of values in Rich text box?

Hi All,



i just need to know about how to remove a single value from a group of values in a rich text box
It deals with the two custom fields namely classes (Rich text box) and Completed Classes(Text box) and Two triggers.

Defaultly i created a trigger to auto populate all the class name from Trigger 1,
Now i need is once completed class value choosed, the choosed value from The Rich text box should be Removed from the Trigger 2



Classes containing lst of class name like as follows
Class 1 , Class 2, Class 3

In completed class user choosed one value among from the Above Rich text box
For Ex:

If User choose class 2 in Completed class,
We should remove the class 1 value from the Rich text box
So the rich text box should display value as

Class 1
Class 3

NOTE: Currently im using a trigger to populate all the available classes in thr rich text box and what i need to do is to remove the selected value from Rich text box

Your suugestion are most welcome

Thanks

Vinu 

Navatar_DbSupNavatar_DbSup

Hi,

 

You have to write a trigger to achieve this. Try the below code as reference (This trigger is on contact object made changes accordingly):

 

trigger RemoveFromRichText on Contact (before insert)

{

    string st=trigger.new[0].To_be_scheduled__c;// To_be_scheduled is rich text field.

    string st1=trigger.new[0].scheduled_classes__c; //scheduled_classes is text field.

    string new1=st.replace(st1,'');

    trigger.new[0].To_be_scheduled__c=new1;

    system.debug('@@@@@@@@@@@@@@@@@@@' +new1);

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.