• Jefferson Fernandez
  • NEWBIE
  • 79 Points
  • Member since 2016
  • Software Engineer
  • Accenture

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 7
    Questions
  • 32
    Replies
Hi, I am doing my first lightning org and getting very frustrated by the speed with which config changes are appearing on the page.
For example, I added a new value to a picklist on the contact, then refreshed the contact page - no change.
On the fifth refresh, the new picklist value appear.
I am sure the problem is that Lightning is caching as much as possible to improve the user experience, but  I am wondering is there a magic developer flag to say "Don't cache anything until I am finished development"
 
  • September 01, 2017
  • Like
  • 0
I'm using lightning:isurladdressable to open a subtab, then in turn fire a createRecord event with default values populated. It opens 2 sub tab "Loading..." and the "New" tab. I want to close the "Loading..." and go back to "New". I can close the Loading tab but the focus goes to the first tabs that were opened and not the "New" tab that. I used the getAllTabInfo to possibly use the Id and focus to the New tab but its not there. Any ideas on how to go to the New after closing the Loading...


User-added imageUser-added image
 
({ doInit : function(component, event, helper) { var callback = function(response) { if (response) { helper.fireCreateEvent(component, event, response); helper.closeBlankSubtab(component, event, response); } } let pgState = component.get("v.pageReference").state; component.set("v.acctId", pgState.c__acctId); var params = { "acctId" : component.get("v.acctId") } helper.callServer(component, 'c.getDirectAcr', params, callback, helper); }, }
fireCreateEvent : function(component, event, acr) {
        var createEvent = $A.get("e.force:createRecord");
            createEvent.setParams({
            "entityApiName" : "AccountContactRelation",
            "defaultFieldValues" : {
                "ContactId" : acr.ContactId,
                "JobTitle__c" : acr.JobTitle__c,
                "Language__c" : acr.Language__c,
                "CommunicationMethod__c" : acr.CommunicationMethod__c,
                "Function__c" : acr.Function__c,
                "Telephone__c" : acr.Telephone__c,
                "MobilePhone__c" : acr.MobilePhone__c,
                "Fax__c" : acr.Fax__c,
                "Email__c" : acr.Email__c,
                "SafetyResponsible__c" : acr.SafetyResponsible__c,
                "EnvironmentResponsible__c" : acr.EnvironmentResponsible__c,
                "PricingResponsible__c" : acr.PricingResponsible__c,
                "QuotationRepairResponsible__c" : acr.QuotationRepairResponsible__c,
                "FMMainContact__c" : acr.FMMainContact__c,
                "FleetExchange__c" : acr.FleetExchange__c,
                "ONTrack__c" : acr.ONTrack__c,
                "IsDirect" : false
            }
        });
        createEvent.fire();
    },

    closeBlankSubtab: function(component, event, response) {
      let self = this;
      var workspaceAPI = component.find("workspace");
      workspaceAPI
        .getAllTabInfo()
        .then(function(tabInfos) {
          let tabIdToClose;
          for (let i = 0; i < tabInfos.length; i++) {
            for (let j = 0; j < tabInfos[i].subtabs.length; j++) {
              if (tabInfos[i].subtabs[j].title === "Loading...") {
                tabIdToClose = tabInfos[i].subtabs[j].tabId;
              }
            }
          }
          workspaceAPI.closeTab({tabId: tabIdToClose})
            .then(function(result) {  
            });
      })
      .catch(function(error) {
      });
    },

​​​​​​​
 
Hi All,
I'm trying to solve the Setup Org and Cache on Trailhead's Cache module but when i search 'cache' on setup on any of my developer orgs, it can't be found. Has anyone encountered this before?
Thanks,
Hi All,
I need to fetch data from multiple apex methods which yield separate and different lists of objects but I only have one DoInit function and one possible object to be passed to $A.enqueueAction(action). If i call the enqueueAction several times each for a different object, it malfunctions.

Can you think of any solution where I can call different methods on the same class and also set different attributes on my components once the data has returned? without the need of havingg to separate each methods to have its own component. I just created one component just for demo purposes to the client and i want to have it worked the soonest. TIA
Hi All,
I am trying to add a custom component we created to be added as part of the list of objects under the regular "Related" list objects in a standard salesforce layout. Together with the Accounts, Contacts...etc, we would like to add a [MyCustomObject] below them and not as a separate tab which is really possible through the lightning App builder. Is this possible? TIA
Hi All, 
May i ask help in finding out the solution to solve the error above. I am trying to invoke a modal componpent from a 2nd component. So meaning, 1st component is used as a tab in account record page, it has a button that routes to another lightning component, then on that component, it invokes this 3rd component which is the modal component. But its not going through with the error above and stopping at this 2 lines of code:
 
showModal : function(component, event, helper) {
        console.log('@@@ before showModal');
    	document.getElementById("backGroundSectionId").style.display = "block";
    	document.getElementById("newAccountSectionId").style.display = "block";
        console.log('@@@ after showModal');
    },

Below are the complete codes:
USB_CoverageTeamRelatedList.cmp - 1st component
<aura:component controller="USBCoverageTeamRelatedListController"  implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId">
	<aura:attribute name="coverateTeams" type="USBCoverageTeamRelatedListController.CoverageTeamWrapper[]"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
    <article class="slds-card">
        <div class="slds-card__header slds-grid">
            <header class="slds-media slds-media--center slds-has-flexi-truncate">
                <div class="slds-media__figure">
                    <c:svg class="slds-icon slds-icon-standard-contact slds-icon--small" 
                           xlinkHref="/assets/icons/standard-sprite/svg/symbols.svg#team_member"
                           ariaHidden="true"/>
                </div>
                <div class="slds-media__body slds-truncate">
                    <h2>
                        <a href="javascript:void(0);" class="slds-text-link--reset">
                            <span class="slds-text-heading--small">Coverage Teams ({!v.coverateTeams.length})</span>
                        </a>
                    </h2>
                </div>
            </header>
            <div class="slds-no-flex">
                <button class="slds-button slds-button--neutral" onclick="{!c.navigateToMyComponent}">Manage</button>
            </div>
        </div>
        <div class="slds-card__body">
            <table class="slds-table slds-table--bordered slds-no-row-hover slds-table--cell-buffer">
                <thead>
                    <tr class="slds-text-title--caps">
                        <th scope="col">
                            <div class="slds-truncate" title="Name">Name</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Company">Team Role</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Title">Department</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Email">User?</div>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.coverateTeams}" var="obj">
                        <tr class="slds-hint-parent">
                            <th scope="row">
                                <div class="slds-truncate" title="{!obj.name}">
                                    <a id="{!obj.personId}" href="javascript:void(0);" onclick="{!c.gotoRecord}">{!obj.name}</a>
                                </div>
                            </th>
                            <td>
                                <div class="slds-truncate" title="{!obj.role}">{!obj.role}</div>
                            </td>
                            <td>
                                <div class="slds-truncate" title="{!obj.department}">{!obj.department}</div>
                            </td>
                            <td>
                                <div class="slds-truncate" >
                                    <ui:outputCheckbox value="{!obj.isUser}"/>
                                </div>
                            </td>
                        </tr>
                	</aura:iteration>
                </tbody>
            </table>
        </div>
        <div class="slds-card__footer">
            <a href="javascript:void(0);" onclick="{!c.navigateToMyComponent}">View All 
                <span class="slds-assistive-text">entity type</span>
            </a>
        </div>
    </article>
</aura:component>

USB_CoverageTeamRelatedListController.js
({
	doInit : function(component, event, helper) {
        var action = component.get("c.getCoverageTeams");
        
        action.setParams({
            accountId : component.get("v.recordId")
        });
        
        action.setCallback(this, function(a) {
            if (a.getState() === "SUCCESS") {
                var out_Map = [];
                var objWrap = a.getReturnValue();
                console.log('*****SUCCESS');
                console.log(objWrap);
                var wrappers=new Array();
                for (var idx=0; idx<objWrap.length; idx++) {
                    console.log('*****iterate object');
                	console.log(objWrap[idx]);
                    /*
                    var wrapper = { 'acc' : objWrap[idx],
                        'recordId' : false
                        //@AuraEnabled
                                   public Id recordId {get;set;}
                                   @AuraEnabled
                                   public String name {get;set;}
                                   @AuraEnabled
                                   public String role {get;set;}
                                   @AuraEnabled
                                   public String department {get;set;}
                                   @AuraEnabled
                                   public Boolean isUser {get;set;}
                                   @AuraEnabled
                                   public Id userId {get;set;}
                    };
                    */
                    //wrappers.push(wrapper);
                    //alert('objWrap'+objWrap[idx]);
                }
                //cmp.set('v.wrappers', wrappers);
                component.set("v.coverateTeams", objWrap);
            } else if (a.getState() === "ERROR") {
                console.log('*****ERROR');
                $A.log("Errors", a.getError());
            }
        });
        
        $A.enqueueAction(action);
    },
    
    gotoRecord : function (component, event, helper) {
        var navEvt = $A.get("e.force:navigateToSObject");
        var recordId = event.target.id;
        navEvt.setParams({
            "recordId": recordId,
            "slideDevName": "detail"
        });
        navEvt.fire();
    },
    
    navigateToMyComponent : function(component, event, helper) {
        console.log("navigateToMyComponent: START");
        var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
            componentDef : "c:USB_CoverageTeamViewAll",
            componentAttributes: {
                parentId : component.get("v.recordId")
            }
        });
        evt.fire();
        console.log("navigateToMyComponent: END");
    }
})

USB_CoverageTeamViewAll.cmp - 2nd component
<aura:component controller="USBCoverageTeamRelatedListController"  implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickAction">
	<aura:attribute name="coverateTeams" type="USBCoverageTeamRelatedListController.CoverageTeamWrapper[]"/>
    <aura:attribute name="parentId" type="Id"/>
    <aura:attribute name="parentName" type="String"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
    <article class="slds-card">
        <br/>
        <div class="slds-grid slds-wrap slds-grid--pull-padded">
            <div class="slds-card__header slds-grid">
                <nav role="navigation" aria-label="Breadcrumbs">
                    
                    <ol class="slds-breadcrumb slds-list--horizontal">
                        <li class="slds-breadcrumb__item slds-text-title--caps"><a href="javascript:void(0);" onclick="{!c.navHome}">Accounts</a></li>
                        <li class="slds-breadcrumb__item slds-text-title--caps"><a id="{!v.parentId}" href="javascript:void(0);" onclick="{!c.gotoRecord}">{!v.parentName}</a></li>
                    </ol>
                </nav>
            </div>
                
        </div>
        <div class="slds-card__header slds-grid">
            
            <header class="slds-media slds-media--center slds-has-flexi-truncate">
                <div class="slds-media__figure">
                    <c:svg class="slds-icon slds-icon-standard-contact slds-icon--small" 
                           xlinkHref="/assets/icons/standard-sprite/svg/symbols.svg#team_member"
                           ariaHidden="true"/>
                </div>
                <div class="slds-media__body slds-truncate">
                    <h2>
                        <a href="javascript:void(0);" class="slds-text-link--reset">
                            <span class="slds-text-heading--small">Coverage Teams ({!v.coverateTeams.length})</span>
                        </a>
                    </h2>
                </div>
            </header>
            <div class="slds-no-flex">
                <button class="slds-button slds-button--neutral" onclick="{!c.showModal}">Add Team Member</button>
            </div>
        </div>
        <div class="slds-card__body">
            <table class="slds-table slds-table--bordered slds-no-row-hover slds-table--cell-buffer">
                <thead>
                    <tr class="slds-text-title--caps">
                        <th scope="col">
                            <div class="slds-truncate" title="Name">Name</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Company">Team Role</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Title">Department</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Email">User?</div>
                        </th>
                        <th scope="col">
                            
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.coverateTeams}" var="obj">
                        <tr class="slds-hint-parent">
                            <th scope="row">
                                <div class="slds-truncate" title="{!obj.name}">
                                    <a id="{!obj.personId}" href="javascript:void(0);" onclick="{!c.gotoRecord}">{!obj.name}</a>
                                </div>
                            </th>
                            <td>
                                <div class="slds-truncate" title="{!obj.role}">{!obj.role}</div>
                            </td>
                            <td>
                                <div class="slds-truncate" title="{!obj.department}">{!obj.department}</div>
                            </td>
                            <td>
                                <div class="slds-truncate" >
                                    <ui:outputCheckbox value="{!obj.isUser}"/>
                                </div>
                            </td>
                            <td>
                                <div class="slds-shrink-none">
                                    <lightning:buttonMenu class="slds-button slds-button--icon-border-filled slds-button--icon-x-small" 
                                                          alternativeText="More options" iconName="utility:down" iconSize="x-small" onselect="{! c.doSomething }">
                                        <lightning:menuItem label="Edit"   value="edit" />
                                        <lightning:menuItem label="Delete"   value="delete" />

                                    </lightning:buttonMenu>

                                </div>
                            </td>
                        </tr>
                	</aura:iteration>
                </tbody>
            </table>
        </div>
        <div class="slds-card__footer"><a href="javascript:void(0);">View All <span class="slds-assistive-text">entity type</span></a></div>
    </article>
</aura:component>

USB_CoverageTeamViewAllController.js
({
    doInit : function(component, event, helper) {
        var action = component.get("c.getCoverageTeams");
        
        action.setParams({
            accountId : component.get("v.parentId")
        });
        
        action.setCallback(this, function(a) {
            if (a.getState() === "SUCCESS") {
                var out_Map = [];
                var objWrap = a.getReturnValue();
                console.log('*****SUCCESS');
                console.log(objWrap);
                var wrappers=new Array();
                
                component.set("v.coverateTeams", objWrap);
                component.set("v.parentId", objWrap[0].parentId);
                component.set("v.parentName", objWrap[0].parentName);
                
            } else if (a.getState() === "ERROR") {
                console.log('*****ERROR');
                $A.log("Errors", a.getError());
            }
        });
        
        $A.enqueueAction(action);
    },
    
	gotoRecord : function (component, event, helper) {
        var navEvt = $A.get("e.force:navigateToSObject");
        var recordId = event.target.id;
        navEvt.setParams({
            "recordId": recordId,
            "slideDevName": "detail"
        });
        navEvt.fire();
    },
        
    navHome : function (component, event, helper) {
        var homeEvent = $A.get("e.force:navigateToObjectHome");
        homeEvent.setParams({
            "scope": "Account"
        });
        homeEvent.fire();
    },
        
    doSomething : function (component, event, helper) {
        
    },
    
    showModal : function(component, event, helper) {
        console.log('@@@ before showModal');
    	document.getElementById("backGroundSectionId").style.display = "block";
    	document.getElementById("newAccountSectionId").style.display = "block";
        console.log('@@@ after showModal');
    },
    
})
USB_CoverageTeamModalComponent.cmp - 3rd (modal) component
<aura:component controller="USB_CoverageTeamModalComponentController">
    <aura:attribute name="newMember" type="Coverage_Team__c"
        default="{ 'sobjectType': 'Coverage_Team__c',
        'Team_Member__c': '',
        'Team_Role__c': '',
        'Account__c': ''
        }"/>

<!--START OF MODAL CONTAINER-->
	<div aria-hidden="false" id="newAccountSectionId" role="dialog" class="slds-modal slds-fade-in-open" style="display:none;">
		<div class="slds-modal__container">
            
<!--START OF MODAL HEADER-->
			<div class="slds-modal__header">
				<h2 class="slds-text-heading--medium">Add Coverage Team Member</h2>
				<button class="slds-button slds-button--icon-inverse slds-modal__close" onclick="{!c.showModalBox}">
                   <c:svg class="slds-button__icon slds-button__icon--large"
                    xlinkHref="/resource/SLDS/assets/icons/action-sprite/svg/symbols.svg#close"
                    ariaHidden="true"
                    />
		
                    <span class="slds-assistive-text">Close</span>
				</button>
			</div>
<!--END OF MODAL HEADER-->
            
<!--START OF MODAL BODY-->            
		<div class="slds-modal__content">            
			<div>
                
                <div> 
                    <h3 class="slds-section-title--divider">Information</h3>
                </div>

<!--START OF 1ST GRID-->                 
	<div class="slds-grid">
        
  		<div class="slds-col">
    		<div class="slds-text-align--center">    
        		<div class="slds-p-around--medium">
        				<div class="slds-form-element">
					<div class="slds-form-element__control">
						<ui:inputText aura:id="accname" label="Name"
                            class="slds-input"
                            labelClass="slds-form-element__label"
                            value="{!v.newMember.Team_Member__c}"
                            required="true"/>
                    </div>
				</div>
    		</div>        
    	</div>
  	</div>
    
  		<div class="slds-col">
    		<div class="slds-text-align--center">       
        		<div class="slds-p-around--medium">
                	<div class="slds-form-element">
                		<div class="slds-form-element__control">
                			<ui:inputText aura:id="accname" label="Role"
                                class="slds-input"
                                labelClass="slds-form-element__label"
                                value="{!v.newMember.Team_Role__c}"
                                required="true"/>
                		</div>
                	</div>  
         		</div>        
  			</div>
  		</div>
        
	</div> <!--end of grid--> 
<!--END OF 1ST GRID--> 

    	<div> 
             <h4 class="slds-section-title--divider">System Information</h4>
        </div>    

<!--START OF 2ND GRID-->                
 	<div class="slds-grid">  
       
         <div class="slds-p-horizontal--small slds-size--1-of-2">               
             <div class="slds-p-around--medium">
                <div class="slds-form-element">
                	<div class="slds-form-element__control">
                		<ui:inputText aura:id="accname" label="Account"
                            class="slds-input"
                            labelClass="slds-form-element__label"
                            value="{!v.newMember.Account__c}"
                            required="true"/>
                	</div>
                </div>
             </div>            
     	</div>
        
   </div>  
<!--END OF 2ND GRID-->
                
	</div>
</div>
<!--END OF MODAL CONTAINER-->

<!--START OF MODAL FOOTER-->
            <div class="slds-modal__footer">
                <div class="slds-x-small-buttons--horizontal">
                    <button class="slds-button slds-button--neutral" onclick="{!c.showModalBox}" >Cancel</button>
                    <button class="slds-button slds-button--neutral" >Save New</button>
                    <button class="slds-button slds-button--neutral slds-button--brand" onclick="{!c.saveMember}">Save</button>
                </div>
            </div>
<!--END OF MODAL FOOTER-->
            
    	</div>
    </div>
<!--START OF MODAL CONTAINER-->  
    
<div class="slds-backdrop slds-backdrop--open" id="backGroundSectionId" style="display:none;"></div>

</aura:component>

USB_CoverageTeamModalComponentController.js
({
    showModalBox : function(component, event, helper) {
        console.log('@@@@ before show modal');
    	document.getElementById("backGroundSectionId").style.display = "none";
    	document.getElementById("newAccountSectionId").style.display = "none";
        console.log('@@@@ after show modal');
    },
     
    saveMember : function(component, event, helper) {     
    	var action = component.get("c.saveMembers");
    	action.setParams({
    		"member" : component.get("v.newMember")
    	});     
	    action.setCallback(this, function(a) {
	    	if (a.getState() === "SUCCESS") {
	    		document.getElementById("backGroundSectionId").style.display = "none";
	    		document.getElementById("newAccountSectionId").style.display = "none";
	    	} else if (a.getState() === "ERROR") {
	    		$A.log("Errors", a.getError());
	    	}
	    });	     
	    $A.enqueueAction(action);
    },
    
})


 
Hi,
Can anyone review the codes quickly and check why the component is not showing on the list of available components on the lightning app builder although it has force:appHostable? Thanks!

COMPONENT
<aura:component controller="NonUserAccountTeamController" 
implements="force:appHostable,force:hasRecordId,flexipage:availableForAllPageTypes">

	<aura:attribute name="nonUserAccountTeamMembers" type="Non_User_Account_Team__c[]" />
	<aura:attribute name="employees" type="Employee__c[]" />
	
	<aura:handler name="updateNonUserAccountTeam" event="c:updateNonUserAccountTeamUser"
        action="{!c.handleUpdateNonUserAccountTeam}"/>
			
	<aura:handler name="init" action="{!c.doInit}" value="{!this}" />
    
    <div class="slds">
 
      <div class="slds-page-header">
        <div class="slds-grid">
          <div class="slds-col slds-has-flexi-truncate">
            <p class="slds-text-heading--label">Coverage Team</p>
              <div class="slds-grid">
                <div class="slds-grid slds-type-focus slds-no-space">
                  <h1 class="slds-text-heading--medium slds-truncate" title="Coverage Team">
                  {!'Coverage Team Members ' + '(' + 'Non_User_Account_Team__c[].size' +')'}
                  </h1>
                </div>
                <ui:button aura:id="button" buttonTitle="Manage the employees handling this account" 
                class="button" label="Add Coverage Team Members" press="{!c.clickAdd}"/>
              </div>
           </div>
         </div>
       </div> <!-- End of Header -->
		</div> <!-- End of SLDS -->
    <c:NonUserAccountTeamListItem nonUserAccountTeams="nonUserAccountTeamMembers" employees="employees"/>
    
    <ui:button aura:id="button" buttonTitle="View all the members of this team" 
    class="button" label="View All" press="{!c.clickViewAll}"/>
     

	
</aura:component>

CONTROLLER: 
({
	doInit : function(component, event, helper) {
		// Prepare the action to load account record
		var action = component.get("c.getUsers");
		action.setParams({
			"recordId" : component.get("v.recordId")
		});
		// Configure response handler
		action.setCallback(this, function(response) {
			var state = response.getState();
			if(component.isValid() && state === "SUCCESS") {
				component.set("v.nonUserAccountTeamMembers", response.getReturnValue());
			} else {
				console.log('Problem getting account, response state: ' + state);
			}
		});
		$A.enqueueAction(action);
	},
	
	clickAdd : function (component, event, helper) {
	    var createRecordEvent = $A.get("e.force:createRecord");
	    createRecordEvent.setParams({
	        "entityApiName": "Non_User_Account_Team__c"
	    });
	    createRecordEvent.fire();
	},
	
	clickViewAll : function (component, event, helper) {
	    var relatedListEvent = $A.get("e.force:navigateToRelatedList");
	    relatedListEvent.setParams({
	        "relatedListId": "nonUserAccountTeamMembers",
	        "parentRecordId": component.get("v.recordId")
	    });
	    relatedListEvent.fire();
	},
	
	handleUpdateNonAccountUserTeam: function(component, event, helper) {
		//Update the new expense
		var updatedUser = event.getParam("nonUserAccountTeamMember");
		helper.updateUser(component, updatedUser);
	},
	
})

HELPER:
({
	saveUser: function(component, user, callback) {
	    var action = component.get("c.saveUser");
	    action.setParams({
	        "user": user
	    });
	    if (callback) {
	        action.setCallback(this, callback);
	    }
	    $A.enqueueAction(action);
	},

	
	createUser: function(component, user) {
	    this.saveExpense(component, user, function(response){
	        var state = response.getState();
	        if (component.isValid() && state === "SUCCESS") {
	            var users = component.get("v.nonUserAccountTeamMembers");
	            expenses.push(response.getReturnValue());
	            component.set("v.nonUserAccountTeamMembers", users);
	        }
	    }); 
	},
	
	updateUser: function(component, user) {
	    this.saveExpense(component, user);
	},
	
})

 
Hi All,

May I ask some help because of this error

"Challenge Not yet complete... here's what's wrong: 
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."

All classes were saved without errors. Here are my codes:

<---AnimalLocator class--->
public class AnimalLocator {
    
    public static String getAnimalNameById(Integer id) {
        Http http = new Http();
        HttpRequest request = new HTTPRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/:id');
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        String strRes = '';
        System.debug('response code: ' + response.getStatusCode());
        System.debug('reseponse body: ' + response.getBody());
        
        //If the response is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
            Map<String, Object> animals = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
        
        //Cast the value in the animals' key as list.
       // List<Object> animals = (List<Object>) results.get('animal');
        System.debug('received the following: ' + animals);
        strRes = String.valueOf(animals.get('name'));
        System.debug('strRes: ' + strRes);
        }   // end if
        
        return strRes;
    }   // end method
}   // end classpublic class AnimalLocator {
    
    public static String getAnimalNameById(Integer id) {
        Http http = new Http();
        HttpRequest request = new HTTPRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/:id');
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        String strRes = '';
        System.debug('response code: ' + response.getStatusCode());
        System.debug('reseponse body: ' + response.getBody());
        
        //If the response is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
            Map<String, Object> animals = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
        
        //Cast the value in the animals' key as list.
       // List<Object> animals = (List<Object>) results.get('animal');
        System.debug('received the following: ' + animals);
        strRes = String.valueOf(animals.get('name'));
        System.debug('strRes: ' + strRes);
        }   // end if
        
        return strRes;
    }   // end method
}   // end class

<---AnimalLocatorMock--->
@isTest
global class AnimalLocatorMock implements HttpCalloutMock  {
    
    global HttpResponse respond(HttpRequest request) {
        // create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animal:"{"id":1,"name":"dog","eats":"meat","says":"arf arf!"}}');
        response.setStatusCode(200);
        return response;
        
    }   // end method
}   // end class@isTest
global class AnimalLocatorMock implements HttpCalloutMock  {
    
    global HttpResponse respond(HttpRequest request) {
        // create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animal:"{"id":1,"name":"dog","eats":"meat","says":"arf arf!"}}');
        response.setStatusCode(200);
        return response;
        
    }   // end method
}   // end class


<----AnimalLocatorTest----->
@isTest
public class AnimalLocatorTest  {
    
    @isTest static void testGetCallout() {
        //Set mock callout class
        Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock());
        //This causes a fake response to be sent
        //from the class that implements HttpCalloutMock
        String result = AnimalLocator.getAnimalNameById(1);
        String expectedResult='dog';
        System.assertEquals(result, expectedResult);

    }   // end method
    
}   // end class {@isTest
public class AnimalLocatorTest  {
    
    @isTest static void testGetCallout() {
        //Set mock callout class
        Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock());
        //This causes a fake response to be sent
        //from the class that implements HttpCalloutMock
        String result = AnimalLocator.getAnimalNameById(1);
        String expectedResult='dog';
        System.assertEquals(result, expectedResult);

    }   // end method
    
}   // end class {
 
Hello all,

I followed the directions in the Trailhead module and clicked https://localhost:8443. I received the below error.

This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

I have internet connection, there is no proxy, and I turned off the firewall. I saw documentation that suggested checking for missing "listen:443". I found it in the nginx.conf file. Any help would be appreciated. Thank you.
I'm trying to get below lightning component into a own custom component.

User-added image

Seems not exposed to embed, just tried below and no luck.
 
<c:recordDetail recordId="{!v.contactId}"/>

No COMPONENT named markup://c:recordDetail found :

Any help on achieving this, so that it will show up default layout set up for the profile of current user.
First question.  We wrote a lightning record page to customize the lead conversion process.  Is there a way to override the Lead "convert" button with the custom lightning component.  We were able to override the "new" button to use a custom lightning bundle component.  However, on the "convert" button, only the "visualforce page" override action exist.  

Second question.  In lightning lead path, when the "Mark Status as Complete" action for Converted is selected, it is launching the standard convert page even if the convert button is override with a visualforce page.  Is this a setup that can be changed?
I have created the lightning app like below

<aura:application access="Global" extends="ltng:outApp" >
Hello World
</aura:application>

I can able to display the app with component in VF page .
But Can't able to dispaly app without component in VF page.
I tried but unable to get the answer.
Please suggest , Thanks in advance.

Regards
Nachu RY
 
Hi All,

I do have 10 users with different  custom profiles and now i want to restrict all 9 user  records  ?
I have removed view all permissions to 10th user at profile level although i am seeing admin records   ?
how can i do it.any help is appreciated?

Thanks,
Ram 
I have built following apex trigger code and isAfter code is not executing because I have used recursive method in this trigger.

Please have a look into this and let me know what i have did wrong in this code :
 
trigger CreateOrderForOpportunity on Opportunity (before insert, after insert, after update) {
    
    if(trigger.isInsert){
        
        Map<ID,Schema.RecordTypeInfo> rt_Map = Opportunity.sObjectType.getDescribe().getRecordTypeInfosById();
        List<SBQQ__Quote__c> quotelist = new List<SBQQ__Quote__c>();
        List<SBQQ__QuoteLine__c> quoteLineList = new  List<SBQQ__QuoteLine__c>();
        List<SBQQ__QuoteLine__c> quoteLineDataServiceList = new  List<SBQQ__QuoteLine__c>();
        
        for(Opportunity opp : trigger.New){
            
            if(rt_map.get(opp.recordTypeID).getName().contains('CONECTIVIDAD') && opp.Coming_from_Portal__c == True){
                
                if(trigger.isBefore){
                    if(opp.Owner_Email_Address_coming_from_portal__c != Null){
                        List<user> uList = [select Id, Email from user where Email =: opp.Owner_Email_Address_coming_from_portal__c Limit 1];
                        if(uList.size() > 0)
                            for(User u : uList){
                                opp.OwnerId = u.Id;
                            }
                    }
                    if(opp.Portal_Account_Name__c != Null){
                        List<Account> AccList = [select Id, Name from Account where Name =: opp.Portal_Account_Name__c Limit 10000];
                        if(AccList.size() > 0){
                            for(Account a : AccList){
                                opp.AccountId = a.Id;
                            }
                        }
                    }
                }
            }
        }
        if(checkRecursive.checkOneTime()){
            for(opportunity oppAfter : trigger.New){
                if(rt_map.get(oppAfter.recordTypeID).getName().contains('CONECTIVIDAD') && oppAfter.Coming_from_Portal__c == True){
                    if(trigger.isAfter){
                        system.debug('--isAfter->>>>');
                        SBQQ__Quote__c quote = new SBQQ__Quote__c();
                        quote.SBQQ__Account__c = oppAfter.AccountId;
                        quote.Quote_Type__c = 'Draft';
                        quote.SBQQ__Opportunity2__c = oppAfter.Id;
                        quote.Requerimientos_del_cliente__c = 'PORTAL';
                        quote.SBQQ__PriceBook__c = '01s70000000JxjL';
                        quote.Primary_Contact__c = [Select Id from Contact where AccountId =: oppAfter.AccountId Order By createdDate Limit 1].Id;
                        if(oppAfter.PlazoContratacion__c != Null){
                            quote.SBQQ__SubscriptionTerm__c = oppAfter.PlazoContratacion__c;
                        }
                        quotelist.add(quote);
                        
                        if(oppAfter.Quote_line_Product_Name__c != Null){
                            for(Product2 p : [select Id, Name from Product2 where Name =: oppAfter.Quote_line_Product_Name__c]){
                                SBQQ__QuoteLine__c qli = new SBQQ__QuoteLine__c();
                                qli.SBQQ__Product__c = p.Id;
                                if(oppAfter.Product_Special_Price_coming_from_portal__c != Null){
                                    qli.SBQQ__SpecialPrice__c = oppAfter.Product_Special_Price_coming_from_portal__c;
                                }
                                qli.SBQQ__Quote__c = quote.Id;
                                qli.SBQQ__SpecialPriceType__c = 'Custom';
                                if(oppAfter.Quote_line_TipoClearChanel_Velocidad__c != Null){
                                    qli.TipoClearChanel__c = String.ValueOf(oppAfter.Quote_line_TipoClearChanel_Velocidad__c);    
                                }
                                quoteLineList.add(qli);
                            }
                            
                        }
                        SBQQ__QuoteLine__c qliNew = new SBQQ__QuoteLine__c();
                        qliNew.SBQQ__Product__c = '01t7000000Wt7xj';
                        qliNew.SBQQ__Quote__c = quote.Id;
                        qliNew.SBQQ__SpecialPriceType__c = 'Custom';
                        quoteLineDataServiceList.add(qliNew);
                    }
                }
            }
        }
        insert quotelist;
        insert quoteLineList;
        insert quoteLineDataServiceList;
    }
    if(trigger.isUpdate){
        .
		.
		.
    }
}

Please guys help me out !!
I've created a lightning component of registration form.There is one field named "Assigned To" containing lookups of users.When i click on i got this error popup window.I am using  <force:inputField value="{!v.account.Assigned_To__c}" /> nad errors screenshot is given below.User-added image
How to query account on basis of profile i.e.
I want to see how many records have been edited by system admin or any other profile

Thanks in Advance ...
Please help
Hi All,
I'm trying to solve the Setup Org and Cache on Trailhead's Cache module but when i search 'cache' on setup on any of my developer orgs, it can't be found. Has anyone encountered this before?
Thanks,
Hello I am getting bellow error-
Error element Create_Survey_Details (FlowRecordCreate).
This error occurred when the flow tried to create records: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST: Prefer to work alone or as a team: bad value for restricted picklist field: I'd rather work with a team.
What shold i do next? I would appreciate your sugestions.Thanks!
Hello All,

<!-- NewAccount -->
<aura:component implements="force:appHostable" controller="AccountController">
    <aura:attribute name="newAccount" type="Account" default="{ 'sobjectType': 'Account', 'Name': '', }" access="public"/>
    <div >
        <center>
            <form>
                Name <force:inputField aura:id="Name" value="{!v.newAccount.Name}"/>
                Note <force:inputField aura:id="Note" value="{!v.newAccount.Description}"/>
                Categories<force:inputField aura:id="Categories" value="{!v.newAccount.Categories_del__c}"/>
                SubCategories<force:inputField aura:id="SubCategories" value="{!v.newAccount.Sub_Categories__c    }"/>
                Assign to<force:inputField aura:id="Assign To " value="{!v.newAccount.Assigned_To__c}"/>
                Billing Street <force:inputField aura:id="Street " value="{!v.newAccount.BillingStreet}"/>
                Billing City <force:inputField aura:id="City " value="{!v.newAccount.BillingCity}"/>
                Billing State <force:inputField aura:id="State " value="{!v.newAccount.BillingState}"/>
                Billing Country <force:inputField aura:id="Country " value="{!v.newAccount.BillingCountry}"/>
                Billing Postal Code<force:inputField aura:id="Postal Code " value="{!v.newAccount.BillingPostalCode}"/>
                <lightning:button label="Save" onclick="{!c.createAccount}" />
                
            </form>
        </center>
    </div>
</aura:component>



This is my sample code to save Account Record using Lightning Component. "Assign To"  is custom field of "User Lookup" ,  but it gives the following error. Check screen shot as well. I also enabled Lightning component checkbox.


"This page has an error. You might just need to refresh it.
Access Check Failed! AttributeSet.get(): attribute 'inContextOfRecordId' of component 'markup://c:NewAccount {3:0}' is not visible to 'markup://c:NewAccount {3:0}'.
Failing descriptor: {markup://c:NewAccount}"



User-added image
Hi, I am doing my first lightning org and getting very frustrated by the speed with which config changes are appearing on the page.
For example, I added a new value to a picklist on the contact, then refreshed the contact page - no change.
On the fifth refresh, the new picklist value appear.
I am sure the problem is that Lightning is caching as much as possible to improve the user experience, but  I am wondering is there a magic developer flag to say "Don't cache anything until I am finished development"
 
  • September 01, 2017
  • Like
  • 0
Hi, I want to create a button that takes me to to a new lightning page/tab (open as a new tab in browser) on click and also it should get the data chosen from previous lightning page/tab and display it on the new lightning page/tab.
  • August 31, 2017
  • Like
  • 0
hello evryone,
can anyone help me to write the code for "fogot password" 
 
I'm creating a Lightning component that uses aura:iterate to dynamically build a form, with a field for each item in a list object. The markup works great, but I don't know how to go back and get the values from the fields later -- to validate the fields and then to save the values.

I would normally use aura:id to component.find() the field, and then get("v.value"). BUT aura:id is undefined because it can't be dynamically assigned with a merge field. Here's how I was trying to assign aura:id in the iteration markup, but that aura:id assignment doesn't work.
<aura:component >
    <aura:attribute name="topic" type="Topic__c"/>
        <div class="slds-tile slds-hint-parent">
            <div class="slds-form-element slds-is-required">
                <div class="slds-form-element__control">
                    <ui:inputNumber aura:id="{!v.topic.Id}" label="{!v.topic.Name}"
                                    class="slds-input"
                                    labelClass="slds-form-element__label"
                                    value = "{!v.topicResult.score__c}" />   
                </div>
            </div> 
        </div>
</aura:component>
I've double checked that {v.topic.Id} is valid (I can assign it to the label with no problem). I've tried using a simple string in a variable, also with no success. It appears aura:id has to be hard-coded.

So, any ideas on another attribute I can use to identify and call each field?
Is there a way to do a component.find() on a different attribute, like label, that can be set dynamically?

I'm using ui:inputNumber based on my use of it in the Lightning Component Trail on Trailhead (the one with Expenses and the Camping List), but I'm seeing an altenative --  lightning:input (Beta). I'm reading the docs on it, thinking maybe I can use the name attribute, but not sure if I can then component.find() it by name.

Any insight or ideas out there? Thanks.
I want to do a Collapse and show of search criteria in a lightning component but I want to use lightning named motions:
https://lightningdesignsystem.com/guidelines/motion/ , How do I use the lightning named motions? or is there a good example to follow?

Hi,

I have a requirement to edit an objects date field from my lightning component. With the relationship between the objects I have to create a wrapper to display the records and necessary date fields.

When I use aura:iteration with the wrapper ui:inputdate does not work properly. The date the user selects from the calendar does not get updated on the UI, however the values is updated in the back end.

When I use aura:iteration with a list of any concrete object ui:inputdate works properly. The date the user selects from the calendar gets updated on the UI, and the values is also updated in the back end.

Has anyone faced a similar issue and know of any work around for the same?

Thanks
Vivian

I am new to coding as well as to the Lightning Experience. I am trying to create a Custom Lightning Component for a specific Related List so I can create a tab for it on the Lightning App Builder. For example, when viewing an account, I would like to create a custom tab titled "Contacts" that will show me the related contacts for that account. vs. having all the related lists under the "Related" tab. I would also like to do this for other related lists (including custom object related lists), but if provided with assistance for the Custom Lightning Component for the Contacts I can figure it out. Thanks!