• Narsimha Rao
  • NEWBIE
  • 20 Points
  • Member since 2015
  • Sr. Salesforce Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
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.


 
Hello,
I am facing an error "invalid cross reference object" when sending Salesforce Files as attachments via Lightning Email Template through apex code.
I have created a Lightning email template and attached an attachment to that. When we send this email template through apex, it throws the below error. If the attachment is removed from the template, it works fine.

Error message:
System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []

Apex code:
Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
semail.setTemplateId('00X7F000001THAPUA4');
semail.setTargetobjectid('0037F00001FBiQqQAL');
semail.setWhatId('0017F00001LRyRVQA1');
semail.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail});

Content Deliveries and Public Links is checked in my org. Any help would be appreciated.

Thanks!!
Hello, 
I have been trying to login to DevHub using CLI but weirdly, when I use the force:auth command, the browser doesn't even open. I am very new to using the CLI and please let me know if I'm missing something.

Thanks in advance!
I have a lightning:datatable on my lightning component and the component is hosted on visualforce page to be available on classic. Everything works fine except when I try to access the default header actions(Wrap text & Clip text) of a column by clicking on it, the entire page refreshes for no reason. What do I do to avoid that? Also, it works fine when trying the same thing in lightning experience. Any suggestions?

Component Code:
<aura:component>
<aura:attribute name="demodata" type="Object"/>
<aura:attribute name="democolumns" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<lightning:datatable data="{!v.demodata}" 
    columns="{!v.democolumns}" 
    keyField="id"
    onrowselection="{!c.getSelectedAccName}"/>
</aura:component>
Controller Code:
({
init: function (cmp, event, helper) {
cmp.set('v.democolumns', [
            {label: 'Account Name', fieldName: 'accountName', type: 'text'},
            {label: 'Industry', fieldName: 'industry', type: 'text'},
            {label: 'Account Number', fieldName: 'accountNumber', type: 'text'}
        ]);
    cmp.set('v.demodata', [{
            id: 'a',
            accountName: 'Edge Communications',
            industry: 'Education',
            accountNumber: 'CD451796'
        },
        {
            id: 'b',
            accountName: 'GenePoint',
            industry: 'Electronics',
            accountNumber: 'CC978213'
        }]);
},
getSelectedAccName: function (cmp, event) {
    var selectedAccRows = event.getParam('selectedRows');
    for (var i = 0; i < selectedAccRows.length; i++){
        alert(selectedAccRows[i].accountName+" is selected");
    }
}
Sample Reference image in Lightning
User-added image
 
// 
// AutoCaseCreate.cls --- can be scheduled to run at any time interval
//

global class AutoCaseCreate implements Schedulable {

    // Callable from a Unit Test
    public void execute() {
        // Find the Contacts with Related Sales Tax orgs,
        // so that we can assign a new Case to it
        list<Group> USTRID = [SELECT Email,Id,Name,Type FROM Group WHERE Type =:'queue' AND Name=:'USTR' limit 1];
        
        for(contact con : [SELECT Id, (SELECT Id, Name FROM Sales_Tax_Orgs__r ) FROM Contact
                             WHERE Id IN (SELECT Contact__c from Sales_Tax_Org__c WHERE Name != '')])
   
        {
            // Create a new Case for every contact related to sales tax orgs
            Case c = new Case(
                Priority = 'Medium',
                Status = 'New',
                Subject = 'USTR: Initial EOM Request',
                OwnerId = USTRID[0].id,
                Category__c = 'Accounting',
                Sub_Category__c = 'University Sales Tax Reporting',
                Origin = 'YSS USTR Initiated',  
                ContactId = con.id
               
            );
            // Try to insert our Case
            try {
                insert c;
            } catch (DMLException ex) {
                // Handle the error
            }
        }
    }

    global void execute(SchedulableContext sc) {
        execute();
    }
}
Here is my code for a schedule class. I'm not an expert in coding and i'have written this code with the help of some existing forums. It would be very helpful if you guys suggest me how to write the test class for this.

Thanks
 
Hello Forum:

I have a custom object "Sales Tax Report" which has a lookup field(can be changed to Master-detail if required) to Contacts. I have the lookup field on Case to Contacts. After I select a contact on the case record and save it,  I want a Text area field on Case object which lists the Names or Ids of all Sales Tax Report records related to the respective contact. 

I was explaing this to one of my collegues and he suggested me that it can be acheived by an utility class. I'm not sure if that is the correct way or not but any help woud be helpful. 
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.


 
I have a lightning:datatable on my lightning component and the component is hosted on visualforce page to be available on classic. Everything works fine except when I try to access the default header actions(Wrap text & Clip text) of a column by clicking on it, the entire page refreshes for no reason. What do I do to avoid that? Also, it works fine when trying the same thing in lightning experience. Any suggestions?

Component Code:
<aura:component>
<aura:attribute name="demodata" type="Object"/>
<aura:attribute name="democolumns" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<lightning:datatable data="{!v.demodata}" 
    columns="{!v.democolumns}" 
    keyField="id"
    onrowselection="{!c.getSelectedAccName}"/>
</aura:component>
Controller Code:
({
init: function (cmp, event, helper) {
cmp.set('v.democolumns', [
            {label: 'Account Name', fieldName: 'accountName', type: 'text'},
            {label: 'Industry', fieldName: 'industry', type: 'text'},
            {label: 'Account Number', fieldName: 'accountNumber', type: 'text'}
        ]);
    cmp.set('v.demodata', [{
            id: 'a',
            accountName: 'Edge Communications',
            industry: 'Education',
            accountNumber: 'CD451796'
        },
        {
            id: 'b',
            accountName: 'GenePoint',
            industry: 'Electronics',
            accountNumber: 'CC978213'
        }]);
},
getSelectedAccName: function (cmp, event) {
    var selectedAccRows = event.getParam('selectedRows');
    for (var i = 0; i < selectedAccRows.length; i++){
        alert(selectedAccRows[i].accountName+" is selected");
    }
}
Sample Reference image in Lightning
User-added image
 
Hello Helplers

I  have a question related  to  Lihtning:dataTable  componenent
There is an option  the  CLIP  or WRAP  the test  in a cell.
By  Default CLIP  is used and user  can switch to WRAP

What I  want is  to  have the  WRAP  being defaulted

Is  there any  solution for this?

Thanks in advance
Csbaa 
I properly installed CLI. In a command window, I enter:

sfdx force:auth:web:login -d -a DevHub

in order to log in to the trial Dev Hub that I created. The aforementioned command opens the Salesforce login page in the web browser, so I log in using my Developer Hub Trial Org credentials and click Allow. After that, web browser show me an error: "This site can't be reached. localhost took too long to respond".

This is the URL that Salesforce use after I authenticate in the browser: http://localhost:1717/OauthRedirect?code=aPrxbOND3gL_2LbSR7rKPdvD0XBVk2YpErl3pphY2f3xvZ1wf5SSPJByDleRLPMtzCQWnNGAdg%3D%3D&state=f2f8254fac23

I don't know what happen.

User-added image

User-added image

User-added image
Hello Forum:

I have a custom object "Sales Tax Report" which has a lookup field(can be changed to Master-detail if required) to Contacts. I have the lookup field on Case to Contacts. After I select a contact on the case record and save it,  I want a Text area field on Case object which lists the Names or Ids of all Sales Tax Report records related to the respective contact. 

I was explaing this to one of my collegues and he suggested me that it can be acheived by an utility class. I'm not sure if that is the correct way or not but any help woud be helpful.