0

I am getting the below error

This page has an error. You might just need to refresh it. Error in $A.getCallback() [An unknown error occurred attempting to fetch definitions at: https://sit-cscrm.cs12.force.com/auraCmpDef?aura.app=markup://c:CsRepView&_ff=DESKTOP&_l=true&_l10n=en_US&_style=undefined&_def=markup://c:CsRepMyContacts_Rep&_uid=LATEST-0] Failing descriptor: {ltng:outApp}"

when i click the load unsafe scripts then error is not coming and loading the page what could be the reason and how to resolve this issue?

Controller.js

({
doInit : function(component, event, helper) {
   var selvalue='1';
     var pageSize = component.get("v.pageSize");
    var action = component.get("c.getRepMycontacts");
    action.setParams({"selopt":selvalue});
    action.setCallback(this, function(response){
        var name = response.getState();
        if (name === "SUCCESS") {
            component.set("v.con", response.getReturnValue());
            //add
            component.set("v.totalSize", component.get("v.con").length);
            component.set("v.start",0);
            component.set("v.end",pageSize-1);

            var paginationList = [];
            for(var i=0; i< pageSize; i++)
            {
             paginationList.push(response.getReturnValue()[i]);    
}

            component.set('v.paginationList', paginationList);
        }

    });

 $A.enqueueAction(action);
},
showreps : function(component, event, helper) {
   var selvalue = component.find("makeId").get("v.value");
    var action = component.get("c.getRepMycontacts");
    var pageSize = component.get("v.pageSize");
    action.setParams({"selopt":selvalue});
    action.setCallback(this, function(response){
        var name = response.getState();
        if (name === "SUCCESS") {
            component.set("v.con", response.getReturnValue());
            //add
            component.set("v.totalSize", component.get("v.con").length);
            component.set("v.start",0);
            component.set("v.end",pageSize-1);

            var paginationList = [];
            for(var i=0; i< pageSize; i++)
            {
             paginationList.push(response.getReturnValue()[i]);    
}

            component.set('v.paginationList', paginationList);
        }

    });

 $A.enqueueAction(action);

},
export : function(component, event, helper) {

    var data = component.get("v.con");
    console.log(data);
    // call the helper function which "return" the CSV data as a String   
    var csv = helper.convertArrayOfObjectsToCSV(component,data);   
     if (csv == null){return;} 

    // ####--code for create a temp. <a> html tag [link tag] for download the CSV file--####     
     var hiddenElement = document.createElement('a');
      hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
      hiddenElement.target = '_self'; // 
      hiddenElement.download = 'ExportData.csv';  // CSV file Name* you can change it.[only name not .csv] 
      document.body.appendChild(hiddenElement); // Required for FireFox browser
      hiddenElement.click(); // using click() js function to download csv file
    },

next : function(component, event, helper) 
{

    var conList = component.get("v.con");
    var end = component.get("v.end");
    var start = component.get("v.start");
    var pageSize = component.get("v.pageSize");
    var paginationList = [];

    var counter = 0;
    for(var i=end+1; i<end+pageSize+1; i++)
    {
     if(conList.length > end)
        {
      paginationList.push(conList[i]);
            counter ++ ;
     }
    }
    start = start + counter;
    end = end + counter;

    component.set("v.start",start);
    component.set("v.end",end);

    component.set('v.paginationList', paginationList);
 },
previous : function(component, event, helper) 
{
 var conList = component.get("v.con");
    var end = component.get("v.end");
    var start = component.get("v.start");
    var pageSize = component.get("v.pageSize");
    var paginationList = [];

    var counter = 0;
    for(var i= start-pageSize; i < start ; i++)
    {
     if(i > -1)
        {
         paginationList.push(conList[i]);
            counter ++;
     }
        else
        {
            start++;
        }
    }
    start = start - counter;
    end = end - counter;

    component.set("v.start",start);
    component.set("v.end",end);

    component.set('v.paginationList', paginationList);
}


})

Component:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"  access="global" controller="FetchRepMyContacts"><!--Server-Side/Apex Controller-->
<ltng:require styles="{!$Resource.SLDS252 +
         '/assets/styles/salesforce-lightning-design-system-ltng.css'}"/>



<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<ui:inputSelect aura:Id="makeId" class="pickliststyle" multiple="false" label="Please Select Report Type: ">
        <ui:inputSelectOption label="Yesterday" text="1"/>
        <ui:inputSelectOption label="Last 3 Months" text="2"/>

    </ui:inputSelect><br/><br/>
    <ui:button label="Show Report" class="buttonstyle"  press="{!c.showreps}"/>
    <ui:button label="Export Details" class="buttonstyle" press="{!c.export}"/>

    <br/><br/>
    <aura:attribute name="con" type="contact[]"/><!--List Of Contacts-->
    <!--add-->
    <aura:attribute name="paginationList" type="contact[]"/>
    <aura:attribute name="pageSize" type="Integer" default="8"/>
 <aura:attribute name="totalSize" type="Integer"/>
    <aura:attribute name="start" type="Integer" />
 <aura:attribute name="end" type="Integer"/>
     <!--<ui:button label="Show Rep Contacts" press="{!c.myAction}"/>-->
    <table class="slds-table slds-table--bordered slds-max-medium-table--stacked-horizontal" ><!--Table must be responsive-->
        <thead>
            <tr class="slds-text-heading--label" >
                <th style="background-color: #ee3424;color: white" scope="col">Name</th>
                <th style="background-color: #ee3424;color: white" scope="col">Download Date</th>
                <th style="background-color: #ee3424;color: white" scope="col">Phone</th>
                <th style="background-color: #ee3424;color: white" scope="col">Email</th>
                <th style="background-color: #ee3424;color: white" scope="col">Website Downloads</th>                
            </tr>  
        </thead>
        <tbody>
            <aura:iteration var="q" items="{!v.paginationList}"><!--Dynamic Listing of Vehicles-->
                <tr class="slds-hint-parent">
                    <td data-label="Download Date" style="padding-left:0;">{!q.Name}</td>
                    <td data-label="Download Date" style="padding-left:0;">{!q.Download_Date__c}</td>
                    <td data-label="Phone" style="padding-left:0;">{!q.Phone}</td>
                    <td data-label="Email" style="padding-left:0;">{!q.Email}</td>
                    <td data-label="Account" style="padding-left:0;">{!q.Website_Downloads__c}</td>                
                </tr>
            </aura:iteration>
            <!-- add-->

             <lightning:button class="buttonstyle" label="Previous"     onclick="{!c.previous}"  /><!--disabled="{!v.start == 0}"-->
             <lightning:button class="buttonstyle" label="Next" disabled="{!v.end > v.totalSize}"  onclick="{!c.next}" />

            </tbody>
    </table>  
</aura:component>
  • Please include the relevant code in the body of your post. You can format your code by selecting it and pressing Ctrl-K or clicking {}. – David Reed Jan 28 '19 at 16:09
  • when are you getting error? – Himanshu Jan 28 '19 at 16:34
  • @vasavi_sfdc -> you dont need to load SLDS in lightning, additionally, any reason why you are using ui namespaced components instead of lightning? – glls Jan 28 '19 at 19:13
  • When first time login i am getting the error after clicking the load unsafe scripts in the browser then every thing is working what could be the reason – vasavi_sfdc Jan 29 '19 at 7:48
  • Hmm there is no any specific reason for adding ui namespace. – vasavi_sfdc Jan 29 '19 at 8:05
1

This is because of the salesforce spring release. Add lightning component dependency in the lightning app. <aura:dependency resource="CsRepMyContacts_Rep"/>

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.