• Lavi__c
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
Hello Everyone,
I have two lightning web components and I have to navigate from one LWC to another LWC on button click. 
I tried navigation service to apply the NavigationMixin function in component’s base class to extends NavigationMixin(LightningElement).but it dint work.

can please anyone help me?
Thank you.
 
  • September 18, 2019
  • Like
  • 0
Hello Everyone,

I have an email template which I want to send by apex class.I am getting an Email notification but merge field's value is not showing.I tried many solutions but not getting the result.Please, can anyone help me?
Here is the snap of my email template
Email template

And apex code:-
 
global class sampleBatch implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext bc) {
    String query = 'Select id,Name from book__c;
    return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext bc, List<book__c> books){ 
    Map<Id, List<Case>> associatedCases = CaseHelperClass.getCase(new Map<Id,book__c>(books).keySet());
    Map<Id,book__c> bookMap= new Map<Id,book__c>(books);
    EmailTemplate emailTemplate = [SELECT Id,Subject,Description,HtmlValue,DeveloperName,Body FROM EmailTemplate WHERE DeveloperName =: 'sameple_template'];
    if(associatedCases <> null){
        for(Id bookId : associatedCases.keySet()){
            String headerAndAssociatedCases = 'CaseNumber,Type,Status,Subject,Description,CreatedDate\n';
            for(Case c : associatedCases.get(bookId)){
                headerAndAssociatedCases += c.CaseNumber+','+c.Type+','+c.Status+','+c.Subject+','+c.Description+','+c.CreatedDate+'\n';
            }
            Messaging.EmailFileAttachment csvAttachment = new Messaging.EmailFileAttachment();
            blob csvBlob = Blob.valueOf(headerAndAssociatedCases);
            csvAttachment.setFileName('Case.csv');
            csvAttachment.setBody(csvBlob);
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            list<string> toAddresses = new list<string>{name@test.com};
            email.setSubject(emailTemplate.Subject);
            email.setTemplateId(emailTemplate.Id);
            email.setPlainTextBody(emailTemplate.Body);
            email.setToAddresses(toAddresses);
            email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttachment});
            Messaging.SendEmailResult [] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
       }
    }
}

global void finish(Database.BatchableContext bc){
    system.debug('Apex Job Done');
}}

Any help will be highly appreciable. Thank you!
 
I have to display records from a custom object into HTML table on button click.I tried to convert it into apex pageblock table but it's not working and records will be generated based on some criteria. Please anyone can help me? Here is the VF page :-
<apex:commandButton styleClass="btn btn-primary btn-lg finish-step" action="{!display}" onclick="findAllData();return show('newStep-6','newStep-5');" value="GetRate"/>               
                              <table class="table">
                              <!--<apex:pageBlock >-->
                              <!--<apex:pageblockTable styleclass="table" value="{!lender}" var="m">-->
                                <thead>
                                    <tr>
                                        <th width="25%">Lender 
                                            <span class="short-icon"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/short-icon.png')}"/></a></span>
                                        </th>
                                        <th width="25%">Rate
                                            <span class="short-icon"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/short-icon.png')}"/></a></span>
                                        </th>
                                        <th width="25%">Payment
                                            <span class="short-icon"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/short-icon.png')}"/></a></span>
                                        </th>
                                        <th width="25%">&nbsp;</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <apex:repeat value="{!lender}" var="m">
                                    <tr>
                                        <td class="comp"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/clogo/1.jpg')}"/></a>
                                            <div class="info">
                                                <span class="review">
                                                    <i class="glyphicon glyphicon-star"></i><i class="glyphicon glyphicon-star"></i><i class="glyphicon glyphicon-star"></i><i class="glyphicon glyphicon-star"></i><i style="color:#e3dfd9" class="glyphicon glyphicon-star"></i> (230)
                                                </span>
                                                <span class="lender-info"><a href="#">Lender info</a></span>
                                            </div>
                                        </td>
                                        <td>
                                         <div class="price">
                                            <small>20 year fixed</small>
                                            <!--<h1>3.250% <small>APR</small></h1>-->

                                            <h1>{!m.Rate__c}<small>APR</small></h1>
                                            <small>3.250% Rate | At 0 pts</small>
                                        </div>
                                        </td>
                                        <td>
                                         <div class="price">
                                            <small>$0.00 fees</small>
                                            <h1>${!m.Payment__c} <small>/mo</small></h1>
                                            <small>As of 08/02</small>
                                        </div>
                                        </td>
                                        <td><button type="button" class="btn btn-primary btn-lg">Select</button></td>
                                    </tr>
                                    </apex:repeat>
                                     </tbody>
                                    </table>
                                    <!--</apex:pageblockTable>-->
                                     <!--</apex:pageBlock>-->
and extention code:-
global with sharing class RateExtentions {
public ApexPages.StandardController controller;
public List<Lender__c> lender{get;set;} 

public RateExtentions(){

}
public RateExtentions(ApexPages.StandardController controller) {
    this.controller = controller;
    lender = new List<Lender__c>();
}

    //VF method to display lender records according to selected criteria
    public void display(){
        lender = [Select id,Name,Rate__c,Property_Type__c,Occupancy_Type__c From Lender__c where Occupancy_Type__c = 'primary' and Rate__c = 3.414];
            System.debug('lender info::'+lender);
    }
}
Expected output:-
output

any help will be highly appreciable.Thanks
When I Press the Save button it saves the values but when I hit F5 or refresh the values are gone, they are not visible on my VF page.
And for this :
  • I have created VF page with standard controller and extensions.
  • created one controller.
  • And I have embedded VF page into Opportunity object.
Any idea how I can achieve this ??
Thanks.
  • September 02, 2017
  • Like
  • 0
Hello Everyone,

I have an email template which I want to send by apex class.I am getting an Email notification but merge field's value is not showing.I tried many solutions but not getting the result.Please, can anyone help me?
Here is the snap of my email template
Email template

And apex code:-
 
global class sampleBatch implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext bc) {
    String query = 'Select id,Name from book__c;
    return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext bc, List<book__c> books){ 
    Map<Id, List<Case>> associatedCases = CaseHelperClass.getCase(new Map<Id,book__c>(books).keySet());
    Map<Id,book__c> bookMap= new Map<Id,book__c>(books);
    EmailTemplate emailTemplate = [SELECT Id,Subject,Description,HtmlValue,DeveloperName,Body FROM EmailTemplate WHERE DeveloperName =: 'sameple_template'];
    if(associatedCases <> null){
        for(Id bookId : associatedCases.keySet()){
            String headerAndAssociatedCases = 'CaseNumber,Type,Status,Subject,Description,CreatedDate\n';
            for(Case c : associatedCases.get(bookId)){
                headerAndAssociatedCases += c.CaseNumber+','+c.Type+','+c.Status+','+c.Subject+','+c.Description+','+c.CreatedDate+'\n';
            }
            Messaging.EmailFileAttachment csvAttachment = new Messaging.EmailFileAttachment();
            blob csvBlob = Blob.valueOf(headerAndAssociatedCases);
            csvAttachment.setFileName('Case.csv');
            csvAttachment.setBody(csvBlob);
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            list<string> toAddresses = new list<string>{name@test.com};
            email.setSubject(emailTemplate.Subject);
            email.setTemplateId(emailTemplate.Id);
            email.setPlainTextBody(emailTemplate.Body);
            email.setToAddresses(toAddresses);
            email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttachment});
            Messaging.SendEmailResult [] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
       }
    }
}

global void finish(Database.BatchableContext bc){
    system.debug('Apex Job Done');
}}

Any help will be highly appreciable. Thank you!
 
I have to display records from a custom object into HTML table on button click.I tried to convert it into apex pageblock table but it's not working and records will be generated based on some criteria. Please anyone can help me? Here is the VF page :-
<apex:commandButton styleClass="btn btn-primary btn-lg finish-step" action="{!display}" onclick="findAllData();return show('newStep-6','newStep-5');" value="GetRate"/>               
                              <table class="table">
                              <!--<apex:pageBlock >-->
                              <!--<apex:pageblockTable styleclass="table" value="{!lender}" var="m">-->
                                <thead>
                                    <tr>
                                        <th width="25%">Lender 
                                            <span class="short-icon"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/short-icon.png')}"/></a></span>
                                        </th>
                                        <th width="25%">Rate
                                            <span class="short-icon"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/short-icon.png')}"/></a></span>
                                        </th>
                                        <th width="25%">Payment
                                            <span class="short-icon"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/short-icon.png')}"/></a></span>
                                        </th>
                                        <th width="25%">&nbsp;</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <apex:repeat value="{!lender}" var="m">
                                    <tr>
                                        <td class="comp"><a href="#"><apex:image url="{!URLFOR($Resource.rateCountResource1, '/rateCount/assets/images/clogo/1.jpg')}"/></a>
                                            <div class="info">
                                                <span class="review">
                                                    <i class="glyphicon glyphicon-star"></i><i class="glyphicon glyphicon-star"></i><i class="glyphicon glyphicon-star"></i><i class="glyphicon glyphicon-star"></i><i style="color:#e3dfd9" class="glyphicon glyphicon-star"></i> (230)
                                                </span>
                                                <span class="lender-info"><a href="#">Lender info</a></span>
                                            </div>
                                        </td>
                                        <td>
                                         <div class="price">
                                            <small>20 year fixed</small>
                                            <!--<h1>3.250% <small>APR</small></h1>-->

                                            <h1>{!m.Rate__c}<small>APR</small></h1>
                                            <small>3.250% Rate | At 0 pts</small>
                                        </div>
                                        </td>
                                        <td>
                                         <div class="price">
                                            <small>$0.00 fees</small>
                                            <h1>${!m.Payment__c} <small>/mo</small></h1>
                                            <small>As of 08/02</small>
                                        </div>
                                        </td>
                                        <td><button type="button" class="btn btn-primary btn-lg">Select</button></td>
                                    </tr>
                                    </apex:repeat>
                                     </tbody>
                                    </table>
                                    <!--</apex:pageblockTable>-->
                                     <!--</apex:pageBlock>-->
and extention code:-
global with sharing class RateExtentions {
public ApexPages.StandardController controller;
public List<Lender__c> lender{get;set;} 

public RateExtentions(){

}
public RateExtentions(ApexPages.StandardController controller) {
    this.controller = controller;
    lender = new List<Lender__c>();
}

    //VF method to display lender records according to selected criteria
    public void display(){
        lender = [Select id,Name,Rate__c,Property_Type__c,Occupancy_Type__c From Lender__c where Occupancy_Type__c = 'primary' and Rate__c = 3.414];
            System.debug('lender info::'+lender);
    }
}
Expected output:-
output

any help will be highly appreciable.Thanks