• Dasperera
  • NEWBIE
  • 25 Points
  • Member since 2020
  • Associate Software Engineer
  • Wiley Global Technology Pvt Ltd


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I am struggling with building a trigger to create a case when Opportunity is Closed with Setup Needed = Yes (Picklist) and still trying to learn as I run with Apex.

Opportunity fields Stage=Closed Won, Type=Upgrade and Setup Needed=Yes once all 3 of these fields are set to these values I need it to create a Case with Subject containing Opportunity Name and Account Name, also link to Account that is attached to the Opportunity then dump a bunch of the Opportunity fields into the Description field for example:
Customer: {!Account.Name}
AccountNumber: {!Account.AccountNumber__c}
Sold By: {!Opportunity.OwnerFullName}

I had it setup (since minimal coding experience) where it used a workflow to send an email which looped back into SF with Email-to-Case but thats not working 100% so I believe I need to move it into SF directly.

If anyone can help with building the trigger to create the case with field data from the Opp passed into the case that would be great help!
Having issue getting map value.  
Template is a lookup field.  If the lookfield has a value where Require_Num__c = true I want the same value on the Activity record to be true also.  There are several templates so I want to only update Activities where the template has the Require_Num__c = true.
I know I have the right map the map size is 1 since I have only set the field to True on one template.  Just not able to select it in the value.  Right now the activity record field is false when it should be true.
Thanks,
if (Trigger.isInsert){
            List<Id> activityIds = new List<Id>();
        
            for (Activity__c act :(List<Activity__c >) trigger.New)
                {
                    activityIds.add(act.Activity_Template__c);

                }

            if(activityIds.size() > 0){
                list<Activity_Template__c> activitytemplate = [Select Name,Id,Require_Num__c
                                    FROM Activity_Template__c 
                                    WHERE Name,Id,Require_Num__c = true
                                    AND Id in : activityIds]; 
                
                atMap = new Map<Boolean,Activity_Template__c>();
                
                for (Activity_Template__c acts : activitytemplate){
                    atMap.put(acts.Name,Id,Require_Num__c,acts);
                }
            }
            system.debug('map size' + atMap.size() );
            for (Activity__c activities : (List<Activity__c >) trigger.New){
                if (atMap.containsKey(activities.Activity_Template__r.Id)){
                    activities.Name,Id,Require_Num__c = true;
                }
            }
        }

 
I am struggling with building a trigger to create a case when Opportunity is Closed with Setup Needed = Yes (Picklist) and still trying to learn as I run with Apex.

Opportunity fields Stage=Closed Won, Type=Upgrade and Setup Needed=Yes once all 3 of these fields are set to these values I need it to create a Case with Subject containing Opportunity Name and Account Name, also link to Account that is attached to the Opportunity then dump a bunch of the Opportunity fields into the Description field for example:
Customer: {!Account.Name}
AccountNumber: {!Account.AccountNumber__c}
Sold By: {!Opportunity.OwnerFullName}

I had it setup (since minimal coding experience) where it used a workflow to send an email which looped back into SF with Email-to-Case but thats not working 100% so I believe I need to move it into SF directly.

If anyone can help with building the trigger to create the case with field data from the Opp passed into the case that would be great help!
Hello,

I'm building a dynamic HTML string in my helper class and assigning that string as value to lightning:inputRichText. When I add any text to lightning:inputRichText, the value which has the HTML tags is losing the tags. 

Here is a sample dynamic HTML string before adding input text to lightning:inputRichText.
<HTML ><strong><u>Quick Note Details</u></strong><br/>Type of Meeting: General Update<br/>Date: Dec 2, 2019<br/><br/><strong><u>Total Commitments </u></strong><br/>Direct Commitments: $5,098m<br/><br/><strong><u>Opportunities Discussed</u></strong><br/><p><b>SCRF IV (Closed, 125m)</b></p><p>Consultant: Abbott Capital Management (Consultant-led)<ul><li>Summary<ul><li>02-Dec-2019-Test Summary</li></ul></li></ul><br/><br/><strong><u>Organization Overview</u></strong><br/><!--Overview--><br/><br/><strong><u>Organization Details</u></strong><br/><strong>AUM (MM) [USD]: </strong>$110,000<br/><strong>Coverage: </strong><!--Coverage--><br/><strong>Secondary Coverage: </strong>Secondary Coverage<br/><br/><strong><u>Direct Commitments</u></strong><table></table><br/></HTML>
Here is the lightning:inputRichText statement in the component
<lightning:inputRichText value="{!v.emailBody}" label="Body" aura:id="editor" />

Here is HTML value after adding blank space to the input
<p><b><u>Quick Note Details</u></b></p><p>Type of Meeting: General Update</p><p>Date: Dec 2, 2019</p><p><br></p><p><b><u>Total Commitments </u></b></p><p>Direct Commitments: $5,098m</p><p><br></p><p><b><u>Opportunities Discussed</u></b></p><p><b>SCRF IV (Closed, 125m)</b></p><p>Consultant: Abbott Capital Management (Consultant-led)</p><ul><li>Summary<ul><li>02-Dec-2019-Test Summary</li></ul></li></ul><p><br></p><p><br></p><p><b><u>Organization Overview</u></b></p><p><!--Overview-->.</p><p><br></p><p><b><u>Organization Details</u></b></p><p><b>AUM (MM) [USD]: </b>$110,000</p><p><b>Coverage: </b><!--Coverage--></p><p><b>Secondary Coverage: </b>Secondary Coverage</p><p><br></p><p><b><u>Direct Commitments</u></b></p><table></table><p><br></p>

How can I avoid the above from happening? I just want the value to retain the HTML tags and not lose the format.