• Amit Singh 1
  • PRO
  • 2975 Points
  • Member since 2015
  • CRM Consultant
  • Deloitte


  • Chatter
    Feed
  • 87
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 14
    Questions
  • 563
    Replies
I designed the visual force page as quote template(Render as pdf). I passed this visual force page as a custom button in detail page. Once the button click.It's opening the preview of the visual force page. In that, I want to add a send mail logic.

Kindly let me know how to proceed with sending mail logic on this:

This is my visual force code:

<apex:page standardController="Quote"  extensions="sendmailtocustomer"
    showHeader="false" applyHtmlTag="false" applyBodyTag="false" renderAs="PDF"   >
<html>
 
  <head>
 
      <style type="text/css" media="print">
       @page { 
       size: A4; 
       margin: 2in
               0.6in 
               0.2in
               0.5in;  
            @top-center    
             {
                 content: element(header);
             }  
 
             @Bottom-right
              {
                 content: "Page " counter(page);
              }
     
       }
       
       div.header {
        margin-top: 1em;
        position: running(header); 
        color: #191970; }
       
       
              </style>
      
  <style>
        body {
            background-image: url("https://test--c.ap4.visual.force.com/resource/1522828231000/BG_New") ;
            background-repeat:repeat-y;
            background-size:contain;
            background-blend-mode:saturation;
            }       
        </style>
        
        
       
 
      <body style="font-family: sans-serif; font-weight: normal; font-size: 8pt;"  >
      
 
          <div class="header">
            <table width="100%" cellspacing="0" cellpadding="0">            
              <tr>
                    <td valign="top"><img src="{!$Resource.LetterHead}" width="700" /></td>            
              </tr>               
            </table>
           
          </div>
          <br/>
          <br/>
          <table  width="100%">
            <tr height="30">
                <th width="20%" style="vertical-align:top;">Customer Name</th>
                <td width="20%" style="vertical-align:top;">{!Quote.Account.Name}</td>
                <th width="18%" style="vertical-align:top;">Quote Number</th>
                <td width="25%" style="vertical-align:top;">{!Quote.Quote_Number__c}</td>
            </tr>
            <tr height="60">
                <th style="vertical-align:top;">Billing Address</th>
                <td style="vertical-align:top;"><apex:outputtext style="width:10%;word-wrap: break-word;" value="{!Quote.account.BillingStreet}"/><br/>
                    {!Quote.account.BillingCity},&nbsp;
                    {!Quote.account.BillingState}&nbsp;-&nbsp;
                    {!Quote.account.BillingPostalCode},
                    {!Quote.account.BillingCountry}</td>
                    
                    <th width="20%" style="vertical-align:top;">Quotation Date</th>
                  <td width="20%" style="vertical-align:top;">{!Quote.Quotation_Date__c}</td>
                   
                    
                    
                    
                    
                </tr>
                
                <tr height ="30">
                <th style="vertical-align:right">GST No</th>
                <td width="25%" style="vertical-align:top;">{!Quote.GST_No__c}</td>
                </tr>
 
                <tr height="30">  
                <th style="vertical-align:Right;">Quotation Date</th>
                <td style="vertical-align:right;"><apex:outputText value="{0,date,dd/MM/yy}"> <apex:param value="{!Quote.Quotation_Date__c}" /> </apex:outputText></td>
                </tr>
                       <tr height="30">
                <th style="vertical-align:top;">Opportunity Name</th>
                <td style="width:45%;vertical-align:top;">{!Quote.Opportunity.Name}</td>
                </tr>
          </table>
          <br/>
          
          
                 <table>
            <tr>            
                              
                <td><apex:outputtext value="{!Quote.Letter_Head_New__c}" escape="false"/></td>
            </tr>
          </table>
          <br/>
          
       
     
          <table width="100%" border="1"  border-style="solid;" style="border-collapse: collapse;" >
         
            <tr  height="30" width="100%" style="font-family: sans-serif; white-space:nowrap;font-weight: bold; font-size: 10pt; background-color:Gray;">
                <th >S.No</th>
                 <th > Product Name</th>
                <th > Image*</th>
                <th >Quantity</th>
                <th  style="white-space:nowrap;" >Sales Price</th>
                <th > GST%</th>
                <th style="white-space:nowrap;">Discount Amount</th>
                <th style="white-space:nowrap;">After Discount</th>
                
                 
            </tr>
           

            <apex:variable value="{!0}" var="index" />
           <apex:repeat value="{!Quote.QuoteLineItems}" var="Qli">
            <apex:variable value="{!index + 1}" var="index" />
            <tr>
                <td style="text-align:center;" border-style="solid;"  >{!index}.</td>
                  <td style="text-align:left;" border-style="solid;" >{!Qli.Product2.Name}</td>
                <td  style="text-align:center;"><apex:outputText escape="false" value="{!Qli.Image__c}"/></td>
                <td style="text-align:center;" border-style="solid;"  >{!Qli.Quantity}</td>
                <td style="text-align:center;" border-style="solid;" >{!Qli.UnitPrice}</td>
                <td style="text-align:center;" border-style="solid;" >{!Qli.GST__c}</td>
                <td style="text-align:right;" border-style="solid;" >{!Qli.Discount_Amount__c}</td>
                 <td style="text-align:right;" border-style="solid;" >{!Qli.Tax_After_Discount__c}</td>
                    
            </tr>
            </apex:repeat>
          </table>
          <br/>
          <apex:outputText style="page-break-inside: auto;" escape="false">
          <table style="page-break-inside: auto;" width="100%">
            <tr>
                <th></th><td></td>                
                <th style="text-align:right;">Total Sales Price</th><td width="80" style="text-align:right;">{!Quote.TotalPrice}</td>
            </tr>
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">Gross Total</th><td style="text-align:right;">{!Quote.Gross_Total__c}</td>
            </tr>
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">GST Amount</th><td style="text-align:right;">{!Quote.Tax_Amount__c}</td>
            </tr>   
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">Sub Total</th><td style="text-align:right;">{!Quote.Sub_Total__c }</td>
            </tr>     
            
            
          
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">Net Pay</th><td style="text-align:right;">{!Quote.Net_Pay__c}</td>
            </tr>
          </table>
          <br/>
          </apex:outputText>
           <apex:outputText >
           
          <table style="page-break-inside: avoid;">
          
          <tr>
                <th></th><td></td>
                
                <tr> <th> Terms and Condition: </th></tr>
                 <tr>
                 
                <td style="text-align:left" ><apex:outputtext value="{!Quote.Terms_Conditions__c}" escape="false"/></td>
            </tr>
            </tr> 
            <tr> <th></th><td></td></tr>
            <tr> <th></th><td></td></tr>
            
            <tr height="30">
                <td><b>Price Book Ref No.</b>&nbsp;&nbsp;{!Quote.Price_Book_Ref_No__c}</td>
            </tr>
            <tr>
                <td><b>Prepared By</b>&nbsp;&nbsp;{!Quote.Prepared_By__c}</td>
            </tr>
          </table>
          <br/>
          <p style="font-size:10px;">* The images shown in this quotation are for reference only. Our Company reserves the right to change the design, color and specifications of the products with out any prior notice.</p>
          </apex:outputText>     
                
                  
            </body>
           </head>
  </html>
</apex:page>
Hello All,
I need to call a web service from Salesforce. So I have been informed that the end point url will need to look like this with parameter.
GET /abc/def.asmx/ghi?emailTo=string&firstName=string&lastName=string&leadType=string&activityType=string&agree=string&source=string&status=string&streetAddress=string&streetAddress2=string&city=string&state=string&zip=string&country=string&sendsEmail=string&emailFrom=string&activitySubject
My cass looks like this:
public class CallTrexWebServiceInsideSales
{
    Lead leads;
    string message;
        
     {
        message = '';
        leads = [SELECT Email, FirstName , LastName , RecordTypeId, city,  FROM Lead WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
        if(String.isEmpty(leads.email) || String.isEmpty(leads.Account_Type__c)) {
            message = 'This lead is either missing an email address or the Account Type field is NULL.' ; 
            }
        }


    public String myresponse{get;set;}
    public Pagereference getResult()
    {
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        req.setMethod('GET');
        
        String ActivityType = 'Sales';
        string Subject = 'test;
        
        
        String url = 'https://abc/def.asmx/ghi?'+leads+ActivityType +Subject;
        req.setEndpoint(url);
        HTTPResponse resp = http.send(req);
        myresponse=resp.getBody();          

        return null;    }
}

I knowall of the required fields are not in the string url but I was not sure if I approaching this correctly.  I am trying to send data to the webservice and I am not returning anything.  Any help is appreciated.

Cheers,
M

 
Challenge Not yet complete... here's what's wrong: 
A Volunteer Shift Worker record created for the logged in user is not automatically being assigned the correct status.

Created Approval Process and Called it in Process builder still getting errors
Hi,

I am creating lightning tabs dynamically from inside the lightning client side controller.

How can i put my visualforce page inside these tabs?
 
Hi Everyone,

I have created 3 fields in Case object (SubmittedAt, ApprovedAt, TurnAroundTime) and I want to make them null or blank when a case is rejected by approvers.

I know the normal way creating 3 different field updates on Final Rejection Action.

But is there any way to make these 3 fields blank or null in Only one field update?

Thank you,
Sujit
Here on this visualforce page i want to select number of records from the picklist given in the left bottom of the page and then display number of records as per it but, I am not able to fetch the value from picklist to my controller.Following is my visualforce and controller code:
VisualForce code:
<apex:page controller="ContactListViewController">
<apex:form >
<apex:PageBlock >
    <apex:PageBlockTable value="{!ContactList}" var="contacts">
    <apex:column headerValue="Name">
        <apex:outputLink value="/{!contacts.id}">
        {!contacts.name}
        </apex:outputLink>
    </apex:column>
    <apex:column headerValue="Account Name">
        <apex:outputLink value="/{!contacts.account.id}">
            {!contacts.account.name}
        </apex:outputLink>
    </apex:column>
    <apex:column value="{!contacts.Title}"/>
    <apex:column value="{!contacts.Phone}"/>
    <apex:column value="{!contacts.email}"/>
    <apex:inlineEditSupport />
    </apex:PageBlockTable>
    <!-- below code for pagination -->
    <div align = "center">
           <!-- To return to first page of records-->
           <apex:commandButton action="{!stdSetController.first}" value="<<" title="First Page" disabled="{!!stdSetController.HasPrevious}"/>
           <!-- To return to Previous page of records-->
           <apex:commandButton action="{!stdSetController.previous}" value="Previous" disabled="{!!stdSetController.HasPrevious}"/>
           <!-- To return to next page of records-->
           <apex:commandButton action="{!stdSetController.next}" value="Next >" disabled = "{!!stdSetController.HasNext}"/>
           <!-- To return to last page of records-->
            <apex:commandButton action="{!stdSetController.last}" value=">>" title="Last Page" disabled="{!!stdSetController.HasNext}"/>
           <!-- InputText to display current page and to navigate to any page number, At righmost side of page-->
           <span style="float:right">
                <apex:outputLabel value="Page ">
                </apex:outputLabel>
                <apex:InputText value="{!PageNumber}" maxLength="4" size="1"/>
                <!-- To navigate to the page-->
                
                <apex:outputLabel value=" of {!stdSetController.PageNumber}">
                </apex:outputLabel>
            </span>
            <!-- To display a list for number of records to be selected per page-->
            <span style = "float:left">
                <apex:SelectList value="{!RecordsPerPageslist}" size="1">
                    <apex:selectOptions value="{!RecordsPerPageOptionList}">
                    </apex:selectOptions>
                </apex:SelectList>
            </span>
            </div>

</apex:PageBlock>
</apex:form>
</apex:page>

Controller code:
public class ContactListViewController {
    list<contact> con = [SELECT Name,Account.name,Title,Phone,Email FROM Contact];
        public ApexPages.StandardSetController stdSetController{
        get{
        stdSetController = new ApexPages.StandardSetController(con);
                return stdSetController;            
        }
        set;//what is use of this set, if we remove this then error is displayed!. 
        //The value is already set in the getter we just need to use that value not setting it
    }
    public Integer PageNumber{
        get{
            this.PageNumber=stdSetController.getPageNumber();
            return this.PageNumber;
        }
        set{
            stdSetController.setPageNumber(value);
        }
    }
    public Integer MaxNumberOfRecords{
        get{
        return stdSetController.getRecords().size();
        }
        set;
    }
    public list<SelectOption> getRecordsPerPageOptionList(){
        list<selectOption> options = new list<SelectOption>();
            options.add(new selectOption('10','10'));
            options.add(new selectOption('25','25'));
            options.add(new selectOption('50','50'));
            options.add(new selectOption('100','100'));
            options.add(new selectOption('200','200'));
            return options;
    }
    public Integer RecordsPerPageslist{
        get;set{
            if(value==null) 
                this.RecordsPerPageslist=10;
             else
                 this.RecordsPerPageslist=value;
        }    
    }
    public list<contact> getcontactList(){ 
       stdSetController.setPageSize(RecordsPerPageslist);
        return (list<contact>)stdSetController.getRecords();
    }
}

The error displayed on my page is:
Visualforce Error
Help for this Page
System.NullPointerException: Argument 1 cannot be null 
Class.ContactListViewController.getcontactList: line 41, column 1

Hi,
  We had given our org details in the force.com security scanner for the security review but we are not getting any response from them for the review. has anybody faced this issue? what could be the issue with this?

Thanks
Teena Treesa

Hi folks,

I am creating a list of Accounts vf page and showing related contact list for each Accoount record. Below is the VF code and Controller class that I am using.

VF page -
<apex:page standardController="Account" extensions="C9">
    <apex:form >
        <apex:pageBlock >
            <p align="center">
                <apex:commandButton action="{!step1}" value="Create New"/>
            </p>
            <apex:pageBlockTable value="{!acts}" var="a" title="Account">
              <apex:column headerValue="List of Accounts">
               <apex:commandLink rerender="contactDetails" value="{!a.Name}" action="{!ContactLists}" id="details">
                 <apex:param name="id" value="{!a.id}"/>
               </apex:commandLink>
              </apex:column>
            </apex:pageBlockTable>
            
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="First" action="{!setCon.first}"/>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputText>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Next" action="{!setCon.next}"/>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Last" action="{!setCon.last}"/>    
        </apex:pageBlock>
        
        
        <apex:pageBlock title="Contact">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Delete" action="{!DeleteChecked}" />
            </apex:pageBlockButtons>
           <apex:outputPanel id="contactDetails">
             <apex:pageBlockTable value="{!contactsWrapper}" var="con" id="contactswrapper" title="Contact">
                 <apex:column >
                    <apex:inputCheckbox value="{!con.checked}" />
                 </apex:column>
                 <apex:column value="{!con.contact.Name}" />
                 <apex:column value="{!con.contact.Phone}" />
                 <apex:column value="{!con.contact.Email}" />
             </apex:pageBlockTable>
           </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller :-

public class C9 {

    public PageReference Account() {
        return null;
    }


    public C9(ApexPages.StandardController controller) {

    }

    
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select Name, ID  from Account]));
            }
            return setCon;
        }
        set;
    }

    public List<Account> getacts() {
         setCon.setpagesize(10);
         return (List<Account>) setCon.getRecords();
    }
 
        Account account;
        public Account getAccount() {
          if(account == null) account = new Account();
          return account;
       }
       
       public PageReference step1() {
          return Page.v2;
       }
       
       public PageReference save() {
          insert account;
          PageReference v2Page = new ApexPages.StandardController(account).view();
          v2Page.setRedirect(true);
          return Page.v9;
       }
       
       public List<ContactWrapper> contactsWrapper {get;set;}
       public PageReference ContactLists()
       {
       System.debug('The value is:' + contact.Name);
       if (ApexPages.currentPage().getParameters().get('id') != null)
       for (Contact contact : [Select id,Name,Phone,Email from contact where accountId =: ApexPages.currentPage().getParameters().get('id')]){
       contactsWrapper.add(new ContactWrapper(contact,false));
         }
       return null;
       
       }
       public class ContactWrapper {
       public Contact contact {get; set;}
       public Boolean checked {get; set;}
       public ContactWrapper(Contact contact, Boolean checked){
        this.contact = contact;
        this.checked = checked;
        }
      }
    public list <Contact> dltcontacts {get;set;}
    public PageReference DeleteChecked(){    
    dltcontacts=new list<contact>();
    for(ContactWrapper cc: contactsWrapper){
        if(cc.checked){
            dltcontacts.add(cc.contact);
        }
      }
      delete dltcontacts;
      return null;        
    }
}

When I am clicking on Account record to get the related contact list - it is showing the following error

System.NullPointerException: Attempt to de-reference a null object

Error is in expression '{!ContactLists}' in page v9: Class.C9.ContactLists: line 52, column 1
Class.C9.ContactLists: line 52, column 1

Can anyone help me in solving this?
 
I enabled Knowledge on Lightning, Created custom text fields called Question and Answer on Articles, created three types of articles: FAQ, Product, and Community and assigned them to respective layout : faqpagelayout, productpagelayout, and communitypagelayout. 

But am still getting an error: 
Challenge Not yet complete... here's what's wrong: 
Didn't find article record types with the following names: FAQ, Product, and Community. Each article record type must be assigned to the correct page layout.​
How can I convert currency field to word with decimal places like(5000.10 so it will display Five Thousand and Ten Paisa)

I have tried  Apex class and trigger but its now working for me.
public class NumberTOWordConvertion {

    // Call this method with Number to convert
    public String getNumberTOWordConvertion(Decimal num) {

        Decimal junkVal = num;
        Decimal junkValPaisa = junkVal - Math.floor(junkVal);
        junkVal = Math.floor(junkVal);

        String obStr = junkVal.toPlainString();
        String[] numReversed = obStr.split('');
        String[] actnumber = reverse(numReversed);
        String firstHalf = convertInWords(numReversed, actnumber);

        Integer tmp = Math.round(junkValPaisa * 100);
        junkValPaisa = (Decimal)tmp / 100; System.debug('jj :' + junkValPaisa);
        String paisaStr = junkValPaisa.toPlainString();
        String secondHalf;
        if (paisaStr == '0') {
            secondHalf = '';
        } else if (paisaStr.length() != 4) {
            paisaStr = paisaStr + '0';
            paisaStr = paisaStr.substring(2);
            String [] numReversedPaisa = paisaStr.split('');
            String[] actnumberPaisa = reverse(numReversedPaisa);
            secondHalf = convertInWords(numReversedPaisa, actnumberPaisa);
        } else {
            paisaStr = paisaStr.substring(2);
            String [] numReversedPaisa = paisaStr.split('');
            String[] actnumberPaisa = reverse(numReversedPaisa);
            secondHalf = convertInWords(numReversedPaisa, actnumberPaisa);
        }

        String SumOFHalves = '';

        if (secondHalf.length() > 4) {
            firstHalf = firstHalf.replace('Only', 'Rupess And ');
            secondHalf = secondHalf.replace('Only', 'Paisa Only');
            SumOFHalves = firstHalf + secondHalf;
        } else {
            firstHalf = firstHalf.replace('Only', 'Rupess Only');
            SumOFHalves = firstHalf;
        }

        // IF amount has any value
        if (SumOFHalves.length() > 5) {
            return SumOFHalves;
        } else {
            return '';
        }
    }
    // Method reverse the number
    public List<String> reverse(List<String> strToRev) {
        List<String> revList = new List<String>();
        for (Integer i = strToRev.size() - 1; i >= 0; i--) {
            revList.add(strToRev.get(i));
        }
        revList.add('');
        return revList;
    }

    public String convertInWords(String[] numRev, String[] actnum) {
        List<String> iWords = new List<String> {'Zero', ' One', ' Two', ' Three', ' Four', ' Five', ' Six', ' Seven', ' Eight', ' Nine'};
        List<String> ePlace = new List<String> {' Ten', ' Eleven', ' Twelve', ' Thirteen', ' Fourteen', ' Fifteen', ' Sixteen', ' Seventeen', ' Eighteen', ' Nineteen'};
        List<String> tensPlace = new List<String> {'dummy', ' Ten', ' Twenty', ' Thirty', ' Forty', ' Fifty', ' Sixty', ' Seventy', ' Eighty', ' Ninety' };

        Integer iWordsLength = numRev.size();
        String totalWords = '';
        List<String> inWords = new List<String>();
        for (Integer k = 0; k < iWordsLength; k++) {
            inWords.add('');
        }
        String finalWord = '';
        Integer j = 0;

        // Main For loop
        for (Integer i = 0; i < iWordsLength; i++) {

            if (i == 0) {
                if (actnum[i] == '0' || actnum[i + 1] == '1') {
                    inWords[j] = '';
                } else {
                    inWords[j] = iWords[Integer.valueof(actnum[i])];
                }
                inWords[j] = inWords[j] + ' Only';
            } else if (i == 1) {

                if (actnum[i] == '0') {
                    inWords[j] = '';
                } else if (actnum[i] == '1') {
                    inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
                } else {
                    inWords[j] = tensPlace[Integer.valueof(actnum[i])];
                }
            } else if (i == 2) {
                if (actnum[i] == '0') {
                    inWords[j] = '';
                } else if (actnum[i - 1] != '0' && actnum[i - 2] != '0') {
                    inWords[j] = iWords[Integer.valueof(actnum[i])] + ' Hundred and';
                } else {
                    inWords[j] = iWords[Integer.valueof(actnum[i])] + ' Hundred';
                }
            } else if (i == 3) {
                if (actnum[i] == '0' || actnum[i + 1] == '1') {
                    inWords[j] = '';
                } else {
                    inWords[j] = iWords[Integer.valueof(actnum[i])];
                }
                if (actnum[i + 1] != '0' || Integer.valueof(actnum[i]) > 0) {
                    inWords[j] = inWords[j] + ' Thousand';
                }
            } else if (i == 4) {

                if (actnum[i] == '0') {
                    inWords[j] = '';
                } else if (actnum[i] == '1') {
                    inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
                } else {
                    inWords[j] = tensPlace[Integer.valueof(actnum[i])];
                }

            } else if (i == 5) {
                if (actnum[i] == '0' || actnum[i + 1] == '1') {
                    inWords[j] = '';
                } else {
                    inWords[j] = iWords[Integer.valueof(actnum[i])];
                }
                if (actnum[i + 1] != '0' || Integer.valueof(actnum[i]) > 0) {
                    inWords[j] = inWords[j] + ' Lakh';
                }
            } else if (i == 6) {

                if (actnum[i] == '0') {
                    inWords[j] = '';
                } else if (actnum[i] == '1') {
                    inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
                } else {
                    inWords[j] = tensPlace[Integer.valueof(actnum[i])];
                }

            } else if (i == 7) {
                if (actnum[i] == '0' || actnum[i + 1] == '1' ) {
                    inWords[j] = '';
                } else {
                    inWords[j] = iWords[Integer.valueof(actnum[i])];
                }
                inWords[j] = inWords[j] + ' Crore';
            } else if (i == 8) {

                if (actnum[i] == '0') {
                    inWords[j] = '';
                } else if (actnum[i] == '1') {
                    inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
                } else {
                    inWords[j] = tensPlace[Integer.valueof(actnum[i])];
                }

            }

            j++;
        }
        // End of For loop

        // Reverse the List
        inWords = reverse(inWords);

        for (Integer i = 0; i < inWords.size(); i++) {
            finalWord += inWords[i];
        }

        return finalWord;
    }


}
 
trigger convertNumbersToWords on Testing__c (before Insert) { 
   
   
   
 

        
    For(Testing__c T : trigger.new){
    if(T.Test__c>0){
    
    NumberTOWordConvertion ntoWord =  new NumberTOWordConvertion();
     ntoWord.getNumberTOWordConvertion(T.Test__c);
        
      
       
    }
    }
   }

 
Even though my Trailhead login uses my personal email address, my daily digests are going to my work email.  I want the only email attached to Trailhead to be my personal email.  When I go into change it, however, it says it will be sending a confirmation to my email that I must respond to to allow the change.  However, all I get is notification of the change, no way to confirm it, and the email on my account does NOT change to the personal email address.  Help?
When I preview and try to check the challeng, I get this:

line 1:47 no viable alternative at character '"' 
An unexpected error has occurred. Your development organization has been notified.

___

Here's my vf page:
 
<apex:page controller="NewCaseListController">
    
    <ul>
        <apex:pageBlock title="New Cases" id = "cases">
        	<apex:repeat value = "{!newCases}" var = "case">
            	<li>
                    <apex:outputText value = "{!case.id}"/>
                        <br/>
                    <apex:outputLink value = "/{!case.id}">Click here!</apex:outputLink>
                </li>
            </apex:repeat>
        
        </apex:pageBlock>
        
    </ul>
    	
    
</apex:page>

... and here's my controller:
 
public class NewCaseListController {
    // stuff goes here
    
    public List<Case> getNewCases() {
        
        List<Case> results = Database.query(
            'SELECT Id, CaseNumber FROM Case WHERE Status = "New" ');
        
        return results;
        
    }
}

Not sure where on line 1 I'm drawing the blank (invisible) space/character.

Anyone else run into this?
I created vf page and controller but while I am searching, getting an error 
''line 1:56 no viable alternative at character '"'
Error is in expression '{!search}' in component <apex:commandButton> in page testactiveacc: Class.activeAccount.search: line 18, column 1
"

Vf page
<apex:page standardController="Account" extensions="activeAccount" tabStyle="Account">  
  <apex:form > 
  <apex:sectionHeader title="User Global Search" subtitle="Result"/> 
  <apex:pageBlock >
      <apex:pageBlockSection columns="1">
          <apex:pageBlockSectionItem >
              <label>Quick Search</label>
              <apex:outputPanel >
                  <apex:inputText value="{!searchstring}" label="Input"/>
                  <apex:commandButton value="Search records" action="{!search}" reRender="pgId1,pgId2" status="ajaxId"/>
                  &nbsp;<apex:actionStatus startText="Searching..." id="ajaxId"></apex:actionStatus>
              </apex:outputPanel>
          </apex:pageBlockSectionItem>
      </apex:pageBlockSection>
  </apex:pageBlock>
  
  
    
     
   <apex:pageBlock title="Search Active Result" id="pgId1">  
    <apex:pageblockTable value="{!acc}" var="a">  
     <apex:column headerValue="Name" >  
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.Name}</apex:outputlink>       
     </apex:column> 
     <apex:column headerValue="Active" >  
       <apex:outputlink >{!a.Active__c}</apex:outputlink>
     </apex:column> 
     
     <apex:column value="{!a.id}"/>  
    </apex:pageBlockTable>     
   </apex:pageBlock>   
   
   <apex:pageBlock title="Search Inactive Result" id="pgId2">  
    <apex:pageblockTable value="{!acc1}" var="a">  
     <apex:column headerValue="Name" >  
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.Name}</apex:outputlink>       
     </apex:column> 
    <apex:column headerValue="Active" >  
       <apex:outputlink >{!a.Active__c}</apex:outputlink>
     </apex:column>
     
     <apex:column value="{!a.id}"/>  
    </apex:pageBlockTable>     
   </apex:pageBlock>   
   
  </apex:form>  
 </apex:page>

Controller class
public with sharing class activeAccount {
  
   public list <Account> acc {get;set;}
   public list <Account> acc1 {get;set;}
   public string searchstring {get;set;} 
  
   public string value1 {get;set;} 
   
   
    
   public activeAccount (ApexPages.StandardController controller) {
     
   }  
   public void search(){  
     if(searchstring != null && searchstring != '' ){  
     string searchquery='select Name, id,Active__c from Account where Active__c ="Yes" AND Name like \'%'+searchstring+'%\'  Limit 10';  
       string searchquery1='select Name, id,Active__c from Account where Active__c ="No" AND Name like \'%'+searchstring+'%\'  Limit 10';  
     acc = Database.query(searchquery); 
     acc1 = Database.query(searchquery1); 
     }
     }
     
    
   }
Code not working. Can any one help.
 
Hello guys!

I'm having a hard time trying to figure this out.
I need a date field that brings me the last time a case has the owner change, that owner could be a queue or a user. 

How can I do this?
Hi Guys,


I am getting following error when  I am trying to fetch opportunities which I have already fetched in another method.
HEre is my Extension-

public class StandardControllerExtension {

    public Account Acct;
  
    public StandardControllerExtension(ApexPages.StandardController stdController) {
             Acct= (Account)stdController.getRecord();
    }
       Public List<Opportunity> getoppt(){
        
        return [ select name, stageName , Amount , CloseDate From Opportunity where AccountID =:acct.Id and ( LeadSource =  'Web'  And StageName= 'Prospecting')];
       
       }
       public void CreateTaskOnChildOppt(){
         List <Task> newtask = new List<task>();
         for (Opportunity opp : oppt) {
         if(!opp.isclose){
         newtask.add(
 new Task(
 WhatId = opp.Id,
 OwnerId = opp.OwnerId,
 ActivityDate = Date.today() + 3,
 
 Subject = 'Send follow-up email to primary contact'));
         
         }
       
       }
       if (newtask.size() > 0) insert newtask; 
       }
       
       public pageReference Save(){
       if(Acct.Rating=='Hot'){
       CreateTaskOnChildOppt();
       }
       update Acct;
       Return new PageReference('/' + Acct.id);
       }
}

Error-Error: StandardControllerExtension Compile Error: Variable does not exist: oppt at line 15 column 33

Highlighted them for the reference.

Thanks in advance
Hi All,

Can you plz help me on covering the below two lines of attachment for below class. Current code coverage is 86%. Need to get 100%. Thanks
 
User-added image


Test class:

@isTest
public class CaseCreationWithQAttachment_Test {
    static testMethod void test1()
    {
        Case cs = new Case(Subject = 'Test', Origin = 'Phone', Status = 'New');
        insert cs;
        
        Attachment attach=new Attachment();       
        attach.Name='Unit Test Attachment';
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=cs.id;
        insert attach;
        
        List<Attachment> attachments=[select id, name from Attachment where parent.id=:cs.id];
        System.assertEquals(1, attachments.size());
        
        ApexPages.StandardController stdCtr = new ApexPages.StandardController(cs);
        CaseCreationWithQAttachment ctr = new CaseCreationWithQAttachment(stdCtr);
        ctr.caseData = cs;
        ctr.attachData = attach;
        ctr.customSave();   
    }
}
Hi, I'm new to writing triggers and need some assistance with the following code, I have it work for the most part, what is giving me trouble is trying to figure out how to prevent it from creating multiple child cases for the same parent case. For example, if the parent case that fires the trigger has 2 secret keywords, then 2 child cases are created when I only want 1. Thanks in advance.

Here is the trigger code:

trigger CheckSecretInformation on Case (after insert, before update) 
{
    String childCaseSubject = 'Warning this case may contain secret info';

//Step 1: Create a collection containing each secret keyword
    Set<String> secretKeywords = new Set<String>();
    secretKeywords.add('Credit Card');
    secretKeywords.add('Social Security');
    secretKeywords.add('SSN');
    secretKeywords.add('Passport');
    secretKeywords.add('Body Weight');

    //Step 2: Check to see if a case contains any of the secret keywords
    List<Case> casesWithSecretInfo = new List<Case>();
    List<String> secretKeywordsFound = new List<String>();
    
    for (Case myCase : Trigger.new) 
    {
        if (myCase.Subject != childCaseSubject) 
        {
            for (String keyword : secretKeywords) 
            {
                 if (myCase.Description !=null && myCase.Description.containsIgnoreCase(keyword)) 
                {
                    casesWithSecretInfo.add(myCase);
                    secretKeywordsFound.add(keyword);
                    
                    System.debug ('Case ' +myCase.ID + ' includes secret keyword ' +keyword);
                  }
            }
        }

    }
        //Step 3: If a case contains secret keywords, create a child case
        List<Case> caseToCreate = new List<Case>();
        for (Case caseWithSecretInfo : casesWithSecretInfo) 
        {
            if (caseWithSecretInfo.Cases.Size()<1) 
             {
                       
            Case childCase = new Case();
            childCase.Subject = childCaseSubject;
            childCase.ParentId = caseWithSecretInfo.Id;
            childCase.Priority = 'High';
            childCase.IsEscalated = true;
            childCase.Description = 'At least one of the following keywords were found ' + secretKeywordsfound;
            caseToCreate.add(childCase);
             }
        }

        insert caseToCreate;
}
Hi All,
I have a custom object say order,
in that i have created two buttons , create KOT and create BOT button at the same time i have created two custom checkbox field KOT generated and BOT generated , now initialy what is happening on click of the button it is working but i want  at first those two checkbox should be ticked then only the two button should work otherwise not .. 

plz share your views. 
I have 3 objects Event(Master), Package(Detail) and Group Code(Master). I want only one combination of Event and Group code. So how can i implement this?
Hi,

I need help on the following requirement below as follows,

1) I have a account object where contract is another object related to account

2) Contract object is having contract start date and end date which populates to account 

My scenario is 

3)If there are 2 active contract associcated to account and the dates contain

1st Active contracts dates are

start date :1.feb 2017
end date : 31st march 2017

2nd active contract dates are

start date : 1st march 2017
end date : 17th sep 2017

then in this scenatio the first active contract end date should be automatically backdated to the previous month below as follows to avoid overlapping between 2 contracts

1st active contract end date should automatically be changed to 

end date :28th feb 2017
start date should remain the same as 1 feb 2017.

basically both contracts end dates and start dates shouldnt fall in same range to avoid overlapping


I tried the below apex class
 
public class overlapDateHandler{

	public void overlapDateMethod(list<Contract__c> contractList){
	
		set<Id> accountIdSet = new set<Id>();
		list<Account> accList = new List<Account>();
		map<integer, integer> dateMap = new map<integer, integer>{
		1 => 31, 
		3 => 31, 
		4 =>30, 
		5 =>31, 
		6 => 30, 
		7 => 31, 
		8 => 31, 
		9 =>30, 
		10 =>31, 
		11 =>30, 
		12 =>31, };
		map<id, list<Contract__c>> idVsContractmap = new map<id, list<Contract__c>>();
		list<Contract__c> updateContractList = new list<Contract__c>();
		for(Contract__c conObj : contractList){
			
			if(conObj.AccountId  != null){
				
				accountIdSet.add(conObj.AccountId);
			}
		}
		accList = [Select Id, (Select Contract_Start_Date__c, Contract_End_Date__c, AccountId From Contract__c) From Account Where Id IN :accountIdSet]
		for(Account accObj : accList){
			
			idVsContractmap.put(accObj.id, accObj.Contract__c);
		}
		for(Contract__c conObj : contractList){
			
			if(conObj.AccountId != null){
			
				if(idVsContractmap.containsKey(conObj.AccountId)){
					
					for(Contract contractObj : idVsContractmap.get(conObj.AccountId)){
						
						if(contractObj.Contract_End_Date__c.month() == conObj.startdate__c.month()){
							
							if(contractObj.Contract_End_Date__c.month() - 1 == 2){
							
								if(MOD( contractObj.Contract_End_Date__c.year()) + 1, 4) = 0){
									
									string newDate = 29 +'//'+contractObj.Contract_End_Date__c.month() - 1+'//'+contractObj.Contract_End_Date__c.year();
									contractObj.Contract_End_Date__c =  date.parse(newDate);
								}
								else{
									
									string newDate = 28 +'//'+contractObj.Contract_End_Date__c.month() - 1+'//'+contractObj.Contract_End_Date__c.year();
									contractObj.Contract_End_Date__c =  date.parse(newDate);
								}
							}
							else if(contractObj.Contract_End_Date__c.month() - 1 == 0){
								
								string newDate = 31 +'//'+12+'//'+contractObj.Contract_End_Date__c.year() -1;
								contractObj.Contract_End_Date__c =  date.parse(newDate);
							}
							else{
								
								string newDate = 31 +'//'+dateMap.get(contractObj.Contract_End_Date__c.month() - 1)+'//'+contractObj.Contract_End_Date__c.year() -1;
								contractObj.Contract_End_Date__c =  date.parse(newDate);
							}
						}
						updateContractList.add(contractObj);
					}
				}
			}
		}
		update updateContractList;
	}
}

I am gettingthe below error

Error: Compile Error: unexpected token: '}' at line 18 column 17

12 =>31, };

Help me pls

 
Hi Folks,

I am getting Error while trying to create Dual List Dynamically using $A.createComponent

"Assertion Failed!: \"readonly\" must either be a public property of lightningDualListbox or a global HTML attribute : false"

Below is my JavaScript code
doInit : function(component, event, helper) {
        var options = [
            { value: "1", label: "Option 1" },
            { value: "2", label: "Option 2" },
            { value: "3", label: "Option 3" },
            { value: "4", label: "Option 4" },
            { value: "5", label: "Option 5" },
            { value: "6", label: "Option 6" },
            { value: "7", label: "Option 7" },
            { value: "8", label: "Option 8" },
        ];
        $A.createComponent(
            "lightning:dualListbox",
            {
                "aura:id": "findableAuraId",
                "label": "Dual List Demo",
                "selectedLabel":"Selected Options",
                "sourceLabel":"Available Options",
                "options" : options
            },
            function(dualList, status, errorMessage){
                //Add the new button to the body array
                if (status === "SUCCESS") {
                    var body = component.get("v.body");
                    body.push(dualList);
                    component.set("v.body", body);
                }
                else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline."+
                                JSON.stringify(errorMessage))
                }
                    else if (status === "ERROR") {
                        console.log( JSON.stringify(errorMessage));
                    }
            }
        );
    }

Any help will be greatly appreciated. Thanks in Advance.

Thanks & Regards,
Amit
Hi All,

I am getting below error while checking the challenge for Lightning Component Framework Specialist at step 6

Challenge Not yet complete... here's what's wrong: 
The BoatSelected event isn't configured correctly. There is something missing or improperly configured in the BoatSelected.evt file.

Please help
Hi Floks,

Need urgent help in the below problem

I want to create field dependencies b/w two picklist that I already have created into my org Now the problem is that I have more than 1K values into both picklist so wandering if there is any possiblity to do this using Metdata API. I have found https://salesforce.stackexchange.com/questions/67610/manipulating-field-dependencies-with-metadata-api
Link but not sure how to use it. If there is any link or someone having code for the same scenario please help.

Thanks in advance

 
Hi All,

I have cmpleted six steps of Lightning Experience Rollout Specialist Superbadge and I am stucked in Step 7 and Step 8.

Step 7:

Need to Schedule the Report to run at every Monday at 8:00 AM but i can only see two items in picklist one 2:00 AM and one is 11:00 PM\
User-added image

Step 8:

Set up the three types of articles that Lusso’s support team uses, with the following names: FAQ, Product, and Community. Each article type needs to include the Record Type, Question, and Answer fields. Use these names when adding the fields for each of the article types: faqpagelayout, productpagelayout, and communitypagelayout.

As per the requirement need to create Three Article and also we are using Lightning Knowledge and we can not create more than one Knowledge Article type in that ORG then how can I create three article type!

Please help :)
Hi Folks.

Need urgent help. I am stucked into Salesforce Security Checkmarx isue I am getting CRUD Delete error while I have applied all the check into Delete operation. Still getting same Error.
I have a list of Dynamic sObject it can be any sObject. Below is Screenshot of My code and code as.

Please help any help will be greatly appriciated.
public static boolean isSafeObjectDel(List<sobject> delId) {
        boolean result=false;
        Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        for(Sobject del  : delId){
            Id dId = del.id;
            String objName = dId.getSObjectType().getDescribe().getName();
            SObjectType myObj = Schema.getGlobalDescribe().get(objName);
             if (myObj.getDescribe().isDeletable()) {
                result = true; 
            }else{
               return false;
            }
        }
       return result;
       
    }
User-added image


Thanks,
Amit
Hi All,

I am stukked into a requirement my requirement is to show the related articles in console sidebar. I am able to see the same when I am login as System Administer and not able to see if I am login as agent profile. I already added both Milestone and Knowledge article into custom console components. I am not sure if some one have changed the profile setting as it was working fine yesterday.
User-added image

From above setting I am able to see the desired result as Admin but not as Agent. I am only able to see milestone tracker.

Please help me:)
Thanks in advance!
Amit Singh
Can some one provide me the code to open the milestone. I have triged the code and getting the error that you can not change the completion date of milestone that already exited the entitlement process.
public static void reopenMilestone(List<Id> caseIds, String milestoneName, DateTime complDate, Map<Id, String> case_Map) {
    System.debug('#### complDate = '+complDate);
    List<Case> caseList = new List<Case>();
    List<Entitlement> ent = [Select Id From Entitlement LIMIT 1];
    List<CaseMilestone> cmsToUpdate = [select Id, startDate, completionDate,MileStoneTypeId, caseId from CaseMilestone cm where caseId in :caseIds and cm.MilestoneType.Name=:milestoneName limit 1];
    if (cmsToUpdate.isEmpty() == false){
        for (CaseMilestone cm : cmsToUpdate){
            cm.completionDate = null;
            cm.startDate = System.now();
        }
        System.debug('#### cmsToUpdate = '+cmsToUpdate);
        System.debug('#### caseList = '+caseList);
        runOnce = true;
        update cmsToUpdate;
    }
Please help me.
Thanks!
AMit SIngh
Hello All,

I need an urgent help as my miletone timer has stopped and it is showing me the same time even if I refresh the page after 5 minutes. I have tested the same into my Developer Org and it is working fine. I also checked for the stopped button and it is set to false. Also, I am damn sure that no oine has changed the setting into Sandbox Instance.

Please help me:)
Thanks!
Amit Singh
Hello Experts,

I have an urgent requirement in which I need to fetch the Email owner Name from email. Scenaron is given below :

1) I am sending an email from my email using email to case functionality.
2) If cpontact exists then it automaticaly attached that contact with the newly created case.
3) I am facing the problem when contact is not existing then I need to create contact with the actual name that is used into email for example my email id is testing@gmail.com and Name in gmail is Amit Singh then I need to insert contact as Amit Singh and email as testing@gmail.com

Any help will be greatly appreciated.

Please help :)

Thanks!
Amit Singh
Hello, Expert.

While running the macro I am getting the below error 

Attach to Email as PDF
This action isn't available for the selected article.

User-added image

Please let me know how to resolve this issue.

Thanks!
Amit

 
Hello Expert,

I am facing an issue milestone tracker. I have created an Entitlement Process and Milestone and then added to the case the Issue is that it showing me wrong time in Milestone Tracker, for example, I have added 9 hours as the milestone and it shows me 15 hours in milestone tracker but it shows the correct time in the related list of the case. I investigated a lot and did not get any idea. Please help.
 
Thanks!
Amit
Hello Experts,

I wanted to setup "Snap-ins" in my developer org and facing issue while I am looking for " Snap-ins" from Quick search box and not able to see the option.

I already did everything like enabling Live Agent, Site.com, Chat Button and Deployment, Service Cloud User, Live Agent User. 

Let me know what and where I am doing wrong?

Any help will be appreciated.

Thanks,
Amit Singh
Hello Developers,

I am getting "Error: No Lightning Component Quick Actions are available for your organization." Error while trying to create Quick Action into Lightning. I am using below code into my component.
 
<aura:component controller="testPackage1122.caseMergeController"
                implements="force:lightningQuickAction,force:hasRecordId" access="global">
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    <!--Attributes-->
    <aura:attribute name="OriginalCase" type="Case"/>
    <aura:attribute name="SubjectCriteria" type="String[]" default="Contains,Equals"/>
    <aura:attribute name="CaseOrigin" type="String[]" default=""/>
    <aura:attribute name="CaseStatus" type="String[]" default=""/>
    <aura:attribute name="CasePriority" type="String[]" default=""/>
    <aura:attribute name="NumberOfCases" type="String[]" default="2,3,4,5,6,7,8,9,10"/>
    <aura:attribute name="DuplicateCaseList"
                    type="testPackage1122.commonWrapperClass"/>
    <aura:attribute name="DuplicateCaseList1"
                    type="testPackage1122.commonWrapperClass.duplicateCaseListDisplay[]"/>
</aura:component>

I noticed that Error is because of below line.
<aura:attribute name="DuplicateCaseList1"
                    type="testPackage1122.commonWrapperClass.duplicateCaseListDisplay[]"/>

In my code "testPackage1122" in my Org namespace and I need to include this namespace because my component is going to be part of managed package.
 
Any Idea what and where I am doing wrong.
 
Any help or suggestion will be greatly appreciated.
 
Thanks,
Amit Singh
Hi Folks,

My app failed the security review. I am using a javascript custom button and I already had used JSENCODE function. Below is my code that has been provided by the Salesforce security team.
Issue Description

JavaScript of any type is not allowed to run within the Salesforce.com application context. This includes JavaScript blocks within HomePageComponents, WebLinks, Custom buttons and all other components that are run under the Salesforce DOM.

Finding 1 of 1

File

objects\Invoice__c.object
Code

<protected>false</protected>
        <url>{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/connection.js&quot;)} 
{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/apex.js&quot;)} 

if(&quot;{!JSENCODE(Opportunity.Client_ID__c)}&quot;==&quot;&quot;){
   alert(&apos;Opportunity related to this Invoice must be a Client Entity into Freshbooks.&apos;);
}else if(&quot;{!JSENCODE(Account.Account_Id__c)}&quot;==&quot;&quot;){
    alert(&apos;Opportunity related to this Invoice must be associated with a valid Freshbooks Business Entity/Account.&apos;);
}else if(&quot;{!JSENCODE(Opportunity.Email__c)}&quot;==&quot;&quot;){
        alert(&apos;Opportunity related to this Invoice can not have a blank Email address.&apos;);
}else {
   var result = sforce.apex.execute(&quot;Freshbook.syncInvoiceControllerNew&quot;,&quot;getInvoiceDetails&quot;,{invoiceId:&quot;{!JSENCODE(Invoice__c.Id)}&quot;,isClassic:true});
  if(result[0].Freshbook__Synched__c){
       alert(&apos;Invoice Synced Successfully.&apos;);
       location.reload(true); 
   }else{ 
      alert(&apos;Error Occured while Syncing the Invoice with freshbooks.&apos;); 
    }
}</url>
File

Opportunity.object
Code

<url>{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/connection.js&quot;)}
{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/apex.js&quot;)}

if (&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Authentication_URL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Client_Id__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Client_Secret__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.SFBaseURL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Base_URL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Access_Token__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Refresh_Token__c)}&quot; == &quot;&quot;)
{
    alert(&apos;1 or more fields in the Custom Setting are null&apos;);
}
else
{
    if (&quot;{!JSENCODE(Opportunity.Email__c)}&quot; == &quot;&quot;)
    {
        alert(&apos;Opportu
File

Payment__c.object
Code

<openType>onClickJavaScript</openType>
        <protected>false</protected>
        <url>{!REQUIRESCRIPT(&quot;/soap/ajax/36.0/connection.js&quot;)} 
{!REQUIRESCRIPT(&quot;/soap/ajax/36.0/apex.js&quot;)} 

if(&quot;{!(Payment__c.Payment_Date__c)}&quot;==null || &quot;{!(Payment__c.Payment_Date__c)}&quot;==&apos;&apos;){

			alert(&apos;Payment Date can not be null&apos;);

}
else{

if(&quot;{!JSENCODE(Payment__c.Account_Id__c)}&quot;!=null) { 
		var result=sforce.apex.execute(&apos;Freshbook.syncPaymentController&apos;,&apos;getPaymentRecord&apos;,{paymentId:&apos;{!JSENCODE(Payment__c.Id)}&apos;, isClassic:true}); 
		if(result[0].Freshbook__Synched__c){
				alert(&apos;Payment successfully Synched.&apos;); 
                  location.reload(true);
		}
		else{
			alert(&apos;Err
Notes

Please don't write javascript in object files

Please let me know where and what I am doing wrong. Any help will be greatly appreciated.

Thanks,
Amit Singh
Can I delete an user from salesforce and what is freeze
Hi Folks,

I am getting Error while trying to create Dual List Dynamically using $A.createComponent

"Assertion Failed!: \"readonly\" must either be a public property of lightningDualListbox or a global HTML attribute : false"

Below is my JavaScript code
doInit : function(component, event, helper) {
        var options = [
            { value: "1", label: "Option 1" },
            { value: "2", label: "Option 2" },
            { value: "3", label: "Option 3" },
            { value: "4", label: "Option 4" },
            { value: "5", label: "Option 5" },
            { value: "6", label: "Option 6" },
            { value: "7", label: "Option 7" },
            { value: "8", label: "Option 8" },
        ];
        $A.createComponent(
            "lightning:dualListbox",
            {
                "aura:id": "findableAuraId",
                "label": "Dual List Demo",
                "selectedLabel":"Selected Options",
                "sourceLabel":"Available Options",
                "options" : options
            },
            function(dualList, status, errorMessage){
                //Add the new button to the body array
                if (status === "SUCCESS") {
                    var body = component.get("v.body");
                    body.push(dualList);
                    component.set("v.body", body);
                }
                else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline."+
                                JSON.stringify(errorMessage))
                }
                    else if (status === "ERROR") {
                        console.log( JSON.stringify(errorMessage));
                    }
            }
        );
    }

Any help will be greatly appreciated. Thanks in Advance.

Thanks & Regards,
Amit
I designed the visual force page as quote template(Render as pdf). I passed this visual force page as a custom button in detail page. Once the button click.It's opening the preview of the visual force page. In that, I want to add a send mail logic.

Kindly let me know how to proceed with sending mail logic on this:

This is my visual force code:

<apex:page standardController="Quote"  extensions="sendmailtocustomer"
    showHeader="false" applyHtmlTag="false" applyBodyTag="false" renderAs="PDF"   >
<html>
 
  <head>
 
      <style type="text/css" media="print">
       @page { 
       size: A4; 
       margin: 2in
               0.6in 
               0.2in
               0.5in;  
            @top-center    
             {
                 content: element(header);
             }  
 
             @Bottom-right
              {
                 content: "Page " counter(page);
              }
     
       }
       
       div.header {
        margin-top: 1em;
        position: running(header); 
        color: #191970; }
       
       
              </style>
      
  <style>
        body {
            background-image: url("https://test--c.ap4.visual.force.com/resource/1522828231000/BG_New") ;
            background-repeat:repeat-y;
            background-size:contain;
            background-blend-mode:saturation;
            }       
        </style>
        
        
       
 
      <body style="font-family: sans-serif; font-weight: normal; font-size: 8pt;"  >
      
 
          <div class="header">
            <table width="100%" cellspacing="0" cellpadding="0">            
              <tr>
                    <td valign="top"><img src="{!$Resource.LetterHead}" width="700" /></td>            
              </tr>               
            </table>
           
          </div>
          <br/>
          <br/>
          <table  width="100%">
            <tr height="30">
                <th width="20%" style="vertical-align:top;">Customer Name</th>
                <td width="20%" style="vertical-align:top;">{!Quote.Account.Name}</td>
                <th width="18%" style="vertical-align:top;">Quote Number</th>
                <td width="25%" style="vertical-align:top;">{!Quote.Quote_Number__c}</td>
            </tr>
            <tr height="60">
                <th style="vertical-align:top;">Billing Address</th>
                <td style="vertical-align:top;"><apex:outputtext style="width:10%;word-wrap: break-word;" value="{!Quote.account.BillingStreet}"/><br/>
                    {!Quote.account.BillingCity},&nbsp;
                    {!Quote.account.BillingState}&nbsp;-&nbsp;
                    {!Quote.account.BillingPostalCode},
                    {!Quote.account.BillingCountry}</td>
                    
                    <th width="20%" style="vertical-align:top;">Quotation Date</th>
                  <td width="20%" style="vertical-align:top;">{!Quote.Quotation_Date__c}</td>
                   
                    
                    
                    
                    
                </tr>
                
                <tr height ="30">
                <th style="vertical-align:right">GST No</th>
                <td width="25%" style="vertical-align:top;">{!Quote.GST_No__c}</td>
                </tr>
 
                <tr height="30">  
                <th style="vertical-align:Right;">Quotation Date</th>
                <td style="vertical-align:right;"><apex:outputText value="{0,date,dd/MM/yy}"> <apex:param value="{!Quote.Quotation_Date__c}" /> </apex:outputText></td>
                </tr>
                       <tr height="30">
                <th style="vertical-align:top;">Opportunity Name</th>
                <td style="width:45%;vertical-align:top;">{!Quote.Opportunity.Name}</td>
                </tr>
          </table>
          <br/>
          
          
                 <table>
            <tr>            
                              
                <td><apex:outputtext value="{!Quote.Letter_Head_New__c}" escape="false"/></td>
            </tr>
          </table>
          <br/>
          
       
     
          <table width="100%" border="1"  border-style="solid;" style="border-collapse: collapse;" >
         
            <tr  height="30" width="100%" style="font-family: sans-serif; white-space:nowrap;font-weight: bold; font-size: 10pt; background-color:Gray;">
                <th >S.No</th>
                 <th > Product Name</th>
                <th > Image*</th>
                <th >Quantity</th>
                <th  style="white-space:nowrap;" >Sales Price</th>
                <th > GST%</th>
                <th style="white-space:nowrap;">Discount Amount</th>
                <th style="white-space:nowrap;">After Discount</th>
                
                 
            </tr>
           

            <apex:variable value="{!0}" var="index" />
           <apex:repeat value="{!Quote.QuoteLineItems}" var="Qli">
            <apex:variable value="{!index + 1}" var="index" />
            <tr>
                <td style="text-align:center;" border-style="solid;"  >{!index}.</td>
                  <td style="text-align:left;" border-style="solid;" >{!Qli.Product2.Name}</td>
                <td  style="text-align:center;"><apex:outputText escape="false" value="{!Qli.Image__c}"/></td>
                <td style="text-align:center;" border-style="solid;"  >{!Qli.Quantity}</td>
                <td style="text-align:center;" border-style="solid;" >{!Qli.UnitPrice}</td>
                <td style="text-align:center;" border-style="solid;" >{!Qli.GST__c}</td>
                <td style="text-align:right;" border-style="solid;" >{!Qli.Discount_Amount__c}</td>
                 <td style="text-align:right;" border-style="solid;" >{!Qli.Tax_After_Discount__c}</td>
                    
            </tr>
            </apex:repeat>
          </table>
          <br/>
          <apex:outputText style="page-break-inside: auto;" escape="false">
          <table style="page-break-inside: auto;" width="100%">
            <tr>
                <th></th><td></td>                
                <th style="text-align:right;">Total Sales Price</th><td width="80" style="text-align:right;">{!Quote.TotalPrice}</td>
            </tr>
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">Gross Total</th><td style="text-align:right;">{!Quote.Gross_Total__c}</td>
            </tr>
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">GST Amount</th><td style="text-align:right;">{!Quote.Tax_Amount__c}</td>
            </tr>   
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">Sub Total</th><td style="text-align:right;">{!Quote.Sub_Total__c }</td>
            </tr>     
            
            
          
            <tr>
                <th></th><td></td>
                <th style="text-align:right;">Net Pay</th><td style="text-align:right;">{!Quote.Net_Pay__c}</td>
            </tr>
          </table>
          <br/>
          </apex:outputText>
           <apex:outputText >
           
          <table style="page-break-inside: avoid;">
          
          <tr>
                <th></th><td></td>
                
                <tr> <th> Terms and Condition: </th></tr>
                 <tr>
                 
                <td style="text-align:left" ><apex:outputtext value="{!Quote.Terms_Conditions__c}" escape="false"/></td>
            </tr>
            </tr> 
            <tr> <th></th><td></td></tr>
            <tr> <th></th><td></td></tr>
            
            <tr height="30">
                <td><b>Price Book Ref No.</b>&nbsp;&nbsp;{!Quote.Price_Book_Ref_No__c}</td>
            </tr>
            <tr>
                <td><b>Prepared By</b>&nbsp;&nbsp;{!Quote.Prepared_By__c}</td>
            </tr>
          </table>
          <br/>
          <p style="font-size:10px;">* The images shown in this quotation are for reference only. Our Company reserves the right to change the design, color and specifications of the products with out any prior notice.</p>
          </apex:outputText>     
                
                  
            </body>
           </head>
  </html>
</apex:page>
Hello All,
I need to call a web service from Salesforce. So I have been informed that the end point url will need to look like this with parameter.
GET /abc/def.asmx/ghi?emailTo=string&firstName=string&lastName=string&leadType=string&activityType=string&agree=string&source=string&status=string&streetAddress=string&streetAddress2=string&city=string&state=string&zip=string&country=string&sendsEmail=string&emailFrom=string&activitySubject
My cass looks like this:
public class CallTrexWebServiceInsideSales
{
    Lead leads;
    string message;
        
     {
        message = '';
        leads = [SELECT Email, FirstName , LastName , RecordTypeId, city,  FROM Lead WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
        if(String.isEmpty(leads.email) || String.isEmpty(leads.Account_Type__c)) {
            message = 'This lead is either missing an email address or the Account Type field is NULL.' ; 
            }
        }


    public String myresponse{get;set;}
    public Pagereference getResult()
    {
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        req.setMethod('GET');
        
        String ActivityType = 'Sales';
        string Subject = 'test;
        
        
        String url = 'https://abc/def.asmx/ghi?'+leads+ActivityType +Subject;
        req.setEndpoint(url);
        HTTPResponse resp = http.send(req);
        myresponse=resp.getBody();          

        return null;    }
}

I knowall of the required fields are not in the string url but I was not sure if I approaching this correctly.  I am trying to send data to the webservice and I am not returning anything.  Any help is appreciated.

Cheers,
M

 
<lightning:datatable data="{!v.Equipments}"    columns="{!v.equipmentColumns}"    keyField="Id"    hideCheckboxColumn="true"/> 
In Controller:
component.set('v.equipmentColumns', [
          {label: 'Predicted Time', fieldName: 'Prediction_Time__c', type: 'Date', typeAttributes:{year:'numeric',month:'short',day:'2-digit'}},
          {label: 'Origin Station', fieldName: 'Origin_Station__c', type: 'text', sortable: true},
          {label: 'Destintion Station', fieldName: 'Destination_Station__c', type: 'text', sortable: true},
      ]);

Currently it is displaying the date as : 2018-03-15T17:37:00.000Z
but the expected format is : 2018-03-15

Please help
 
Omni channel is supported for Service cloud. But I would like to know does it support lightning application or any visual force page. We are not using Service cloud and using lightning application (custom) to resolve the cases etc. But looking for auto assignment of case to Agents which is done by Omni channel. 
I am trying to retrive data from an external website into a custom object (EZE) in our SF org.  There are multiple fields on the oject that need to be poulated twice a day.  The sample code code from the external site is:

{"id":"AAF-116","name":"LAKE PUMP DEMO","location":"","time":"2018-04-04T00:27:14Z","system":{"fwver":"17071520","lastreset":"2018-04-04 00:05:47","lastcomm":"2018-04-04 00:26:50","lastendpoint":"207.189.176.133:46111","serviceexpiration":"2019-03-01 12:00:00","remainingapi":"1996","remainingalarms":"50","timezone":"US\/Eastern","gmtoffset":"-14400"},"status":"OK","inputs":{"1":{"name":"Supply voltage","raw":12763,"real":12.8,"unit":"V","count":0,"maxval":30,"minval":7,"decimals":"1","alarm":"----"},"2":{"name":"Engine RPM","raw":-1,"real":-1,"unit":"RPM","count":1300,"maxval":2500,"minval":0,"decimals":"0","alarm":"----"},"3":{"name":"Percent of Load","raw":0,"real":0,"unit":"Percent","count":0,"maxval":100,"minval":0,"decimals":"0","alarm":"----"},"4":{"name":"Oil Pressure","raw":-1,"real":-1,"unit":"PSI","count":0,"maxval":105,"minval":0,"decimals":"0","alarm":"----"},"5":{"name":"Coolant Temp","raw":-1,"real":-1,"unit":"F","count":0,"maxval":250,"minval":0,"decimals":"0","alarm":"----"},"6":{"name":"Fuel Level","raw":85,"real":85,"unit":"Percent","count":0,"maxval":100,"minval":0,"decimals":"0","alarm":"----"},"7":{"name":"Fuel Used","raw":7900,"real":790,"unit":"Gal","count":0,"maxval":100,"minval":0,"decimals":"1","alarm":"----"},"8":{"name":"Engine Hours","raw":-1,"real":-0.1,"unit":"Hrs","count":0,"maxval":100,"minval":0,"decimals":"1","alarm":"----"},"9":{"name":"Sump Level","raw":-1,"real":-0,"unit":"Inches","count":0,"maxval":100,"minval":0,"decimals":"0","alarm":"----"},"10":{"name":"Pump Discharge Pressure","raw":-1,"real":-1,"unit":"PSI","count":0,"maxval":400,"minval":0,"decimals":"0","alarm":"----"},"11":{"name":"Amber Warning Lamp","raw":0,"real":0,"unit":"","count":0,"maxval":1,"minval":0,"decimals":"0","alarm":"----"},"12":{"name":"Red Stop Lamp","raw":0,"real":0,"unit":"","count":0,"maxval":1,"minval":0,"decimals":"0","alarm":"----"},"13":{"name":"Active SPN 1","raw":-1,"real":-1,"unit":"","count":0,"maxval":10000,"minval":0,"decimals":"0","alarm":"----"},"14":{"name":"Active FMI 1","raw":-1,"real":-1,"unit":"","count":0,"maxval":1,"minval":0,"decimals":"0","alarm":"----"},"15":{"name":"Key Position","raw":1,"real":1,"unit":"","count":0,"maxval":2,"minval":0,"decimals":"0","alarm":"----"},"16":{"name":"DEF Tank level","raw":-1,"real":-1,"unit":"percent","count":0,"maxval":100,"minval":0,"decimals":"0","alarm":"----"},"17":{"name":"DPF Soot Load","raw":-1,"real":-1,"unit":"percent","count":0,"maxval":200,"minval":0,"decimals":"0","alarm":"----"},"18":{"name":"DPF Ash Load","raw":-1,"real":-1,"unit":"percent","count":0,"maxval":100,"minval":0,"decimals":"0","alarm":"----"},"19":{"name":"High Float","raw":0,"real":0,"unit":"","count":0,"maxval":1,"minval":0,"decimals":"0","alarm":"----"},"20":{"name":"Low Float","raw":0,"real":0,"unit":"","count":0,"maxval":1,"minval":0,"decimals":"0","alarm":"----"},"21":{"name":"Latitude","raw":29129520,"real":29129520,"unit":"degree","count":0,"maxval":10000,"minval":0,"decimals":"0","alarm":"----"},"22":{"name":"Longitude","raw":-81022471,"real":-81022471,"unit":"degree","count":0,"maxval":10000,"minval":0,"decimals":"0","alarm":"----"}},"outputs":{"1":{"name":"Relay 1","state":0},"2":{"name":"Relay 2","state":0},"4":{"name":"Auto Start CI","state":0}},"thermostats":[]}

I am not a developer so I am not sure what the code would be for the Apex clss setup to retrive the data.
Challenge Not yet complete... here's what's wrong: 
A Volunteer Shift Worker record created for the logged in user is not automatically being assigned the correct status.

Created Approval Process and Called it in Process builder still getting errors
I get this error when I try to verify the second step for this badge:
Challenge Not yet complete... here's what's wrong: 
The '# of Volunteers Still Needed' field on the 'Volunteer Shift' record is not working as expected.
This is the formula I used:

MAX( Desired_nr_of_Volunteers__c  -   Shifts_Taken__c ,0)

Can someone please help?
Hi Folks,

My app failed the security review. I am using a javascript custom button and I already had used JSENCODE function. Below is my code that has been provided by the Salesforce security team.
Issue Description

JavaScript of any type is not allowed to run within the Salesforce.com application context. This includes JavaScript blocks within HomePageComponents, WebLinks, Custom buttons and all other components that are run under the Salesforce DOM.

Finding 1 of 1

File

objects\Invoice__c.object
Code

<protected>false</protected>
        <url>{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/connection.js&quot;)} 
{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/apex.js&quot;)} 

if(&quot;{!JSENCODE(Opportunity.Client_ID__c)}&quot;==&quot;&quot;){
   alert(&apos;Opportunity related to this Invoice must be a Client Entity into Freshbooks.&apos;);
}else if(&quot;{!JSENCODE(Account.Account_Id__c)}&quot;==&quot;&quot;){
    alert(&apos;Opportunity related to this Invoice must be associated with a valid Freshbooks Business Entity/Account.&apos;);
}else if(&quot;{!JSENCODE(Opportunity.Email__c)}&quot;==&quot;&quot;){
        alert(&apos;Opportunity related to this Invoice can not have a blank Email address.&apos;);
}else {
   var result = sforce.apex.execute(&quot;Freshbook.syncInvoiceControllerNew&quot;,&quot;getInvoiceDetails&quot;,{invoiceId:&quot;{!JSENCODE(Invoice__c.Id)}&quot;,isClassic:true});
  if(result[0].Freshbook__Synched__c){
       alert(&apos;Invoice Synced Successfully.&apos;);
       location.reload(true); 
   }else{ 
      alert(&apos;Error Occured while Syncing the Invoice with freshbooks.&apos;); 
    }
}</url>
File

Opportunity.object
Code

<url>{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/connection.js&quot;)}
{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/apex.js&quot;)}

if (&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Authentication_URL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Client_Id__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Client_Secret__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.SFBaseURL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Base_URL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Access_Token__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Refresh_Token__c)}&quot; == &quot;&quot;)
{
    alert(&apos;1 or more fields in the Custom Setting are null&apos;);
}
else
{
    if (&quot;{!JSENCODE(Opportunity.Email__c)}&quot; == &quot;&quot;)
    {
        alert(&apos;Opportu
File

Payment__c.object
Code

<openType>onClickJavaScript</openType>
        <protected>false</protected>
        <url>{!REQUIRESCRIPT(&quot;/soap/ajax/36.0/connection.js&quot;)} 
{!REQUIRESCRIPT(&quot;/soap/ajax/36.0/apex.js&quot;)} 

if(&quot;{!(Payment__c.Payment_Date__c)}&quot;==null || &quot;{!(Payment__c.Payment_Date__c)}&quot;==&apos;&apos;){

			alert(&apos;Payment Date can not be null&apos;);

}
else{

if(&quot;{!JSENCODE(Payment__c.Account_Id__c)}&quot;!=null) { 
		var result=sforce.apex.execute(&apos;Freshbook.syncPaymentController&apos;,&apos;getPaymentRecord&apos;,{paymentId:&apos;{!JSENCODE(Payment__c.Id)}&apos;, isClassic:true}); 
		if(result[0].Freshbook__Synched__c){
				alert(&apos;Payment successfully Synched.&apos;); 
                  location.reload(true);
		}
		else{
			alert(&apos;Err
Notes

Please don't write javascript in object files

Please let me know where and what I am doing wrong. Any help will be greatly appreciated.

Thanks,
Amit Singh
how to redirect to the detail record page when you click a button on a lightning component
I have calendar component(component-1) . when ever we click on a date, it pops a table with list of recordspresent in a day(component 2).now when we select a record by checking the check box beside it and click submit button it should be redirected to the record detail page.
Note: all the above is being implemented in a community built for the internal users.
component-2
<aura:component controller="EventDataTableServerCtrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="StartTest" type="Date"/>
    <aura:attribute name="StartDate" type="string" default="0"/>
    <aura:attribute name="EndDate" type="String" default="2018-01-02T12:00:00-05:00"/>
    <aura:attribute name="mydata" type="Object"/>
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="SelectedRecord" type="String[]" default="0"/> 
    <!-- <aura:attribute name="isOpen" type="boolean" default="false"/> -->
          
    <aura:handler name="change" value="{!v.StartTest}" action="{!c.handleValueChange}"/>
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
      
       <div style="height: 300px;">
        <lightning:datatable data="{! v.mydata }" 
        columns="{! v.mycolumns }" 
        keyField="Id"
        resizeColumnDisabled="True"
        onrowselection="{!c.getSelectedName}"/>
        </div>
    
             
       <lightning:button variant="brand" label="Submit" onclick="{! c.closeModel }" /> 
   
 
  
</aura:component>

controller
({
    init: function (cmp, event, helper) {
        //console.log(new Date(cmp.get('v.StartDate')).getMilliseconds());
        cmp.set('v.mycolumns', [
            {label: 'Event Name', fieldName: 'Name', type: 'text'},
            {label: 'Start Date & Time', fieldName: 'Event_Start_date_and_time__c', type: 'Date/Time'},
            {label: 'End Date & Time', fieldName: 'Event_End_Date__c', type: 'Date/Time'}
        ]);
        //helper.getData(cmp);
    },
    handleValueChange : function (component, event, helper) {
         component.set('v.mycolumns', [
            {label: 'Event Name', fieldName: 'Name', type: 'text'},
            {label: 'Start Date & Time', fieldName: 'Event_Start_date_and_time__c', type: 'Date/Time'},
            {label: 'End Date & Time', fieldName: 'Event_End_Date__c', type: 'Date/Time'}
        ]);
        
        // handle value change
        var date = event.getParam("value");
        component.set('v.StartDate',date);
        //component.set('v.StartDate',event.getParam("value"));
        console.log("old value: " + event.getParam("oldValue"));

        console.log("current value: " + event.getParam("value"));
        helper.getData(component);

    },
    getSelectedName: function (cmp, event) {
        
        var selectedRows = event.getParam('selectedRows');
        for (var i = 0; i < selectedRows.length; i++){
            console.log(selectedRows[i].Id);
            cmp.set('v.SelectedRecord',selectedRows[i].Id);
        }
    },
    
   
           
   },
 
   
      gotoURL : function (cmp, event, helper) {
    var eventId = cmp.get('v.SelectedRecord');
    var navEvt = $A.get("e.force:navigateToSObject");
    navEvt.setParams({
      "recordId": eventId,
    });
    navEvt.fire();
    }
})User-added image