• _Zach Boyd
  • NEWBIE
  • 203 Points
  • Member since 2015
  • Fruit of the Loom


  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 38
    Replies
Hello,

I am facing an issue with lightning--

When I click the escalation/transfer button on the case object in the sandbox I am hitting an error

"Something has gone wrong. [NoErrorObjectAvailable] Access Check Failed! AttributeSet.get(): attribute 'transferQueues' of component
' is not visible to 'markup://c:QueueTransfer" . Below is the definition of button.
 
var ticketId = "{!Case.Id}";
var userType = "{!User.UserTypeFormula__c}";
var targetUrl = "/c/TicketTransfer.app#main?caseId="+ticketId;
window.location = (userType == "PowerPartner" ? "/partners" : "") + targetUrl;
The lightning component:
 
<aura:application access="GLOBAL" controller="TaosTransferController">
  <ltng:require styles="/resource/slds/assets/styles/salesforce-lightning-design-system-ltng.css"/>

  <aura:attribute name="page" type="String"/>
  <aura:attribute name="queryParameters" type="String"/>
  <aura:attribute name="ticket" type="Case"/>
  <aura:attribute name="newOwnerId" type="String"/>
  <aura:attribute name="newOwnerName" type="String"/>
  <aura:attribute name="hwCategory" type="String"/>
  <aura:attribute name="hwComponents" type="String"/>
  <aura:attribute name="hwOtherComponent" type="String"/>
  <aura:attribute name="hwSymptoms" type="String"/>
  <aura:attribute name="hwMacAddress" type="String"/>
  <aura:attribute name="hwMfgNumber" type="String"/>

  <aura:handler action="{!c.doInit}" name="init" value="{!this}"/>
  <aura:handler action="{!c.locationChange}" event="aura:locationChange"/>
  <aura:handler action="{!c.updateSelectedOwner}" event="c:ownerSelectEvent"/>
  <aura:handler action="{!c.updateHardwareValues}" event="c:hardwareDataEvent"/>

  <div class="slds">
    <c:grid align="center" style="padding:5%">
      <c:col align="middle" lgSize="10-of-12" mdSize="10-of-12" size="1-of-1">
        <aura:renderIf isTrue="{!v.page == 'main'}">
          <c:TransferMain />
        </aura:renderIf>
        <aura:renderIf isTrue="{!v.page == 'hardware'}">
          <c:hardwareTransfer ticket="{!v.ticket}"/>
        </aura:renderIf>
        <aura:renderIf isTrue="{!v.page == 'confirm'}">
          <c:confirmationPage
            newOwnerId="{!v.newOwnerId}"
            newOwnerName="{!v.newOwnerName}"
            oldOwnerName="{!v.ticket.Owner.Name}"
            ticket="{!v.ticket}">
          </c:confirmationPage>
        </aura:renderIf>
      </c:col>
    </c:grid>
    <aura:if isTrue="{!v.page != 'confirm'}">
      <c:grid align="center">
        <aura:renderIf isTrue="{!and(v.page != 'hardware', v.page != 'main')}">
          <c:button press="{!c.goBack}" type="neutral">Go Back</c:button>
        </aura:renderIf>
      </c:grid>
    </aura:if>
  </div>

</aura:application>
QueueTransfer component
 
<aura:component controller="TaosTransferController">

  <aura:handler action="{!c.doInit}" name="init" value="{!this}"/>
  <aura:attribute name="partnerSite" type="Boolean"/>

  <!--comment test-->

  <div class="slds-form-element">
    <div aria-expanded="true" class="slds-picklist">
      <div class="slds-dropdown-trigger">
        <button aria-haspopup="true" class="slds-button slds-button--neutral
          slds-picklist__label">
          <span class="slds-truncate">Select a Queue</span>
          <c:svg class="slds-icon slds-icon--large" xlinkHref="/resource/slds/assets/icons/utility-sprite/svg/symbols.svg#groups"/>
        </button>
        <div class="slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu">
          <ul class="slds-dropdown__list" role="menu">
            <aura:iteration items="{!v.transferQueues}" var="opt">
              <li class="slds-dropdown__item" href="#confirm">
                <a class="slds-truncate" href="#confirm" id="{!opt.Id}" onclick="{!c.selectNewOwner}" role="menuitem" title="{!opt.Name}">
                  {!opt.Name}
               </a>
              </li>
            </aura:iteration>
            <aura:if isTrue="{!v.partnerSite == false}">
              <li class="slds-dropdown__item" href="#hardware">
                <a class="slds-truncate" href="#hardware" id="00G30000003evAX" onclick="{!c.selectNewOwner}" role="menuitem" title="Vecna Hardware Queue">
                  Vecna Hardware Queue
                </a>
              </li>
            </aura:if>
          </ul>
        </div>
      </div>
    </div>
  </div>

</aura:component>

The Apex Controller
 
public class TaosTransferController {

  private static User runningUser;
  private static Case ticket;
  private static List<Group> queueOptions;
  private static List<User> userOptions;

  @AuraEnabled
  public static User checkUser() {
    if(runningUser == null) {
      runningUser = [
        SELECT Id,Username,Email,FirstName,LastName,Profile.Name
        FROM User WHERE Id = :UserInfo.getUserId()
      ];
    }
    return runningUser;
  }

  @AuraEnabled
  public static Case getTicketInfo(String caseId) {
    if(ticket == null) {
      ticket = [SELECT Id,Owner.Name,Contact.Name,Vecna_Location__c,
      Vecna_Location__r.Vecna_Location_Address_1__c,Vecna_Location__r.Vecna_Location_City__c,
      Vecna_Location__r.Vecna_Location_State__c,Vecna_Location__r.Vecna_Location_Zip_Code__c
      FROM Case WHERE Id = :caseId LIMIT 1];
    }
    return ticket;
  }

  @AuraEnabled
  public static List<Group> getQueues() {
    User u = checkUser();
    List<String> queues = new List<String> {
      'Service Desk Queue','Vecna IT Queue','Vecna Night Escalation Queue','Paper Order Queue','BeneTravel Queue'};
    if(u.Profile.Name != 'Taos Community User') {
      queues.add('Pulse Holding Queue');
      queues.add('Performance Management Queue');
      queues.add('FujiFilm Tickets');
    }
    if(queueOptions == null) {
      queueOptions = [SELECT Id,Name FROM Group WHERE Name IN :queues];
    }
    return queueOptions;
  }

  @AuraEnabled
  public static List <User> getUsers() {
    if(userOptions == null) {
      User u = checkUser();
      if(u.Profile.Name == 'Taos Community User') {
        userOptions = [SELECT Id,Name FROM User WHERE Profile.Name = 'Taos Community User' ORDER BY Name];
      } else {
        userOptions = [
          SELECT Id,Name FROM User
          WHERE (IsActive = true AND UserRole.Name LIKE '%Client Support%') OR Profile.Name = 'Taos Community User'
          ORDER BY Name
        ];
      }
    }

    return userOptions;
  }

  @AuraEnabled
  public static void updateTicket(Case tkt, String comments, Integer paperCases, String oldOwnerName, String newOwnerName) {
    Escalation_Comment__c cmnt = new Escalation_Comment__c();
    cmnt.Comments__c = comments;
    cmnt.Ticket__c = tkt.Id;
    cmnt.From__c = oldOwnerName;
    cmnt.To__c = newOwnerName;
    Database.SaveResult commentResult = Database.insert(cmnt);

    if(commentResult.isSuccess()) {
      tkt.Paper_Cases_Requested__c = paperCases;
      Database.SaveResult ticketResult = Database.update(tkt);
    }
  }

}

Client Side Controller for TicketTransfer:
 
({

  doInit: function(component, event, helper) {

  },

  locationChange: function(component, event, helper) {
    component.set("v.page", event.getParam("token"));

    if (event.getParam("querystring")) {
      helper.handleQueryParameters(component, event);
    }
  },

  goBack: function(component) {
    component.set("v.newOwnerId", "");
    component.set("v.newOwnerName", "");
    window.history.back();
  },

  updateSelectedOwner: function(component, event) {
    component.set("v.newOwnerId", event.getParam("newOwnerId"));
    component.set("v.newOwnerName", event.getParam("newOwnerName"));
  },

  updateHardwareValues: function(component, event) {
    component.set("v.hwCategory", event.getParam("category"));
    component.set("v.hwComponents", event.getParam("components"));
    component.set("v.hwOtherComponent", event.getParam("otherComponent"));
    component.set("v.hwSymptoms", event.getParam("symptoms"));
    component.set("v.hwMacAddress", event.getParam("macAddress"));
    component.set("v.hwMfgNumber", event.getParam("mfgNumber"));
  }

})

Helper for TicketTransfer:
 
({
  handleQueryParameters: function(cmp, event) {

    var queryParams = event.getParam("querystring").split('=');

    if (queryParams.indexOf('caseId') > -1 && !cmp.get("v.ticket")) {
      var action = cmp.get("c.getTicketInfo");
      var id = queryParams[queryParams.indexOf('caseId') + 1];

      action.setParams({
        "caseId": id
      });

      action.setCallback(this, function(actionResult) {
        if (actionResult.getState() === "SUCCESS") {
          var ticket = action.getReturnValue();
          cmp.set("v.ticket", ticket);
        }
      });

      $A.enqueueAction(action);
    }

    if (event.getParam("querystring") === "hardware=true") {
      var hwCategory = cmp.get("v.hwCategory");
      var hwComponents = cmp.get("v.hwComponents");
      var hwOtherComponent = cmp.get("v.hwOtherComponent");
      var hwSymptoms = cmp.get("v.hwSymptoms");
      var hwMacAddress = cmp.get("v.hwMacAddress");
      var hwMfgNumber = cmp.get("v.hwMfgNumber");

      cmp.set("v.ticket.Hardware_Replacement_Category__c", hwCategory);
      cmp.set("v.ticket.Hardware_Replacement_Component__c", hwComponents);
      cmp.set("v.ticket.Other_Component_Info__c", hwOtherComponent);
      cmp.set("v.ticket.Symptoms_Issues__c", hwSymptoms);
      cmp.set("v.ticket.Old_Mac_Address__c", hwMacAddress);
      cmp.set("v.ticket.Old_MFG_Number__c", hwMfgNumber);
    }

  },

})

ClientSide Controller for QueueTransfer:
 
({

    doInit : function(component, event, helper) {
      helper.getQueues(component);
      if(window.location.pathname.indexOf('partners') === -1) {
        component.set("v.partnerSite", false);
      } else {
        component.set("v.partnerSite", true);
      }
    },

    selectNewOwner : function(component, event, helper) {
      var source =  (event.target ? event.target : event.srcElement);
      var newOwnerId = source.id;
      var newOwnerName = source.title;

      $A.get("e.c:ownerSelectEvent").setParams({
          newOwnerId: newOwnerId,
          newOwnerName: newOwnerName
      }).fire();
    }

})

Helper for QueueTransfer:
 
({
	
   getQueues : function(component,event) {
	  var a = component.get("c.getQueues");

	  a.setCallback(this, function(action) {
      if (action.getState() === "SUCCESS") {
        component.set("v.transferQueues", action.getReturnValue());
        var result = component.get("v.transferQueues");
      } else {
        alert(action.getState());
      }

	  });

	  $A.enqueueAction(a);
	},
})

I would appreciate if anyone can help me with this issue. Thanks a lot in advance !

Venkat


 
Hi,
I'm having issues while previewing a Lightning Component using a Lightning App, via Developer Console. 
The next message is shown to me:
"Lightning Components require My Domain...". 
However, I have a My Domain already deployed.

Does anyone here know what is happening?

Regards!
At this point I'm spinning my wheels and need to call on the experts.  I am pulling a list of Strings from SOQL and trying to put them in a String List, but not matter what method I use I always seem to end up with "Illegal assignment from List to List."  Once the list is populated, I want to use it and loop through each value and query a table for records that have the value.  Basically a series of events occur for each value in the string list.  All of the posts on line seem to be saying I have a class of the same name (nope) or I'm using a field when I need a list or something.  None of that seems accurate.  So why else would I be getting this error?  I've tried a lot of different methods to do the list and they all work up to a point, but then I try to use the values and I hit a wall and that error pops up.  Help!

In an nutshell (not actual code)

List<String> test = [Query from System]

for(Integer i=0; i< test.size(); i++){
   for (List<Case> cas : [Query from System where field = test[i]]{
        for(Case c: cas){
           str += c.CaseNumber + ',' + c.CustomField__c;
    }
   //do something with str
  }
}
Hi Guys,

good day!

Just a newbie in here, can you assist me with below Apex Class I already made a Test Class and my Problem in the Test Class is the part of method  deleteOppContRole() wherein it doesn't covered any help please ?

public class OpportunityContactRoleController {
    
    public Id contRoleId {get; set;}
    public Id oppId;
    public Opportunity oppObj;
    public ApexPages.StandardController controller {get; set;}
    

    public List<OpportunityContactRole> oppContRoles {get; set;}
    
    public OpportunityContactRoleController(ApexPages.StandardController controller){
        this.oppObj = (Opportunity)controller.getRecord();
        oppId = this.oppObj.Id;
        
        oppContRoles = [SELECT Id,OpportunityId, Contact.Name, Contact.Email, Role, Contact.Account.Name, Contact.Phone, IsPrimary
                            FROM OpportunityContactRole WHERE OpportunityId = :((Opportunity)controller.getRecord()).Id];
        
    }
    
    public void deleteOppContRole(){
        if(contRoleId != null){
        OpportunityContactRole ocr = new OpportunityContactRole();
        ocr.Id = contRoleId;
        delete ocr;
        oppContRoles = new List<OpportunityContactRole>();
        
        oppContRoles = [SELECT Id,OpportunityId, Contact.Name, Contact.Email, Role, Contact.Account.Name, Contact.Phone, IsPrimary
                            FROM OpportunityContactRole WHERE OpportunityId = :((Opportunity)controller.getRecord()).Id];
        }
        
    }
    
   public pageReference primaryContact() {
     
       PageReference pageRef = Page.OpportunityPrimaryContact;
       pageRef.getParameters().put('Id', oppId);
       pageRef.setRedirect(true);
       
       return pageRef;
   }
    
}
Hi.  I am trying to assign a queue as the case owner.. In a Case Before Trigger, I am have the following.  The case owner is getting updated if the abm__c field is populated.. however, it does not get updated with the queue if that field is null.

Account_Team__c at = aMap.get(c.AccountId);
                // Only change the owner if the Account Team has
                // an ABM and the ABM is an active user. Once assigned
                // set the flag Assigned to ABM
            if (string.isNotBlank(at.abm__c)) {
                if (at.abm__r.IsActive) {
                    c.ownerid = at.abm__c;
                    c.Assigned_To_ABM__c = true;                    
                }
             }
              else {
                c.ownerid = abmQueue[0].Id;
                }

Any help woudl be greatly appreciated!!

Fred
  • October 12, 2016
  • Like
  • 1
I am using the Expense__c tracker app as a template to create a custom lightning component for adding new Events. When I click save on the form, the log in the developer console returns an error: Attempted to upsert a null list.

Here is my Component:
 
<aura:component controller="EventController" implements="force:appHostable,flexipage:availableForAllPageTypes" access="global">
<aura:attribute name="allDay" type="Boolean" default="False"/>
<aura:attribute name="events" type="Event[]"/>
<aura:attribute name="newEvent" type="Event"
                 default="{ 'sobjectType': 'Event',
                         'Subject': 'Default Subject',
                         'OwnerId': '005j000000BRyZ1AAL',
                         'StartDateTime': 'now()',
                         
                         'WhoId': '005j000000BRyZ1AAL',
                         'WhatId': '00Q63000001qAPqEAM',
                         'Consult_Amount__c': '123.10',
                         'Event_Status__c': 'Completed',
                         'Event_Type__c': 'Lunch',
                         'DurationInMinutes': '30'
                       }"/>


<!--Assigned To Form Element -->
<ui:inputSelect label="Assigned To" multiple="false" required="true">
    <ui:inputSelectOption text="All Primary" label="All Contacts" value="true"/>
    <ui:inputSelectOption text="All Primary" label="All Primary"/>
    <ui:inputSelectOption text="All Secondary" label="All Secondary"/>
</ui:inputSelect>
    
<!--Subject Form Element -->	
<ui:inputText label="Subject"  placeholder="Enter Subject" value="{!v.newEvent.Subject}"/>
    
<!--All Day Event Form Element -->
<ui:inputCheckbox label="All Day Event" value="{!v.newEvent.IsAllDayEvent}" />

<!--Renders Date or DateTime UI Input based on All Day Event Check Box -->    
    <aura:if isTrue="{!v.newEvent.IsAllDayEvent}">
        
<!--Start/End Date Form Elements -->
<ui:inputDate aura:id="startdate" label="Start Date" value="{!v.newEvent.StartDateTime}" displayDatePicker="true" />
<ui:inputDate aura:id="enddate" label="End Date" value="{!v.newEvent.EndDateTime}" displayDatePicker="true" />
        <aura:set attribute="else">
            
<!--Start/End DateTime Form Elements -->
<ui:inputDateTime aura:id="startdatetime" label="Start Date" class="field" value="{!v.newEvent.StartDateTime}" displayDatePicker="true" />
<ui:inputDateTime aura:id="enddatetime" label="End Date" class="field" value="{!v.newEvent.EndDateTime}" displayDatePicker="true" />    
    </aura:set>
    </aura:if>
    
<!--Invitee Form Element -->
<ui:inputSelect label="Invitees Of This Event" multiple="True" required="true">
    <ui:inputSelectOption text="All Primary" label="All Contacts" value="true"/>
    <ui:inputSelectOption text="All Primary" label="All Primary"/>
    <ui:inputSelectOption text="All Secondary" label="All Secondary"/>
</ui:inputSelect>
    
<!--Event Type Form Element -->
<ui:inputSelect label="Event Type" multiple="False" required="true">
    <ui:inputSelectOption text="All Primary" label="All Contacts" value="true"/>
    <ui:inputSelectOption text="All Primary" label="All Primary"/>
    <ui:inputSelectOption text="All Secondary" label="All Secondary"/>
</ui:inputSelect>
    
<!--Event Status Type Form Element -->
<ui:inputSelect label="Event Status Type" multiple="False" required="true">
    <ui:inputSelectOption text="Completed" label="Completed" value="true"/>
    <ui:inputSelectOption text="Canceled" label="Canceled"/>
    <ui:inputSelectOption text="No/Show" label="No/Show"/>
</ui:inputSelect>
    
<!--Rescheduled from Prior Consult Form Element -->
<ui:inputCheckbox label="Rescheduled from Prior Consult" value=""/>

<!--Is Paid Consult Form Element -->
<ui:inputCheckbox label="Is Paid Consult" value=""/>

<!--Consult Amount Form Element -->	
<ui:inputText label="Consult Amount" value="Consult Amount" required="true"/>
    
<!--Related To Form Element -->
<ui:inputSelect label="Related To" multiple="False" required="true">
    <ui:inputSelectOption text="Matter" label="Matter" value="true"/>
    <ui:inputSelectOption text="Prospect" label="Prospect"/>
</ui:inputSelect>

<!--Save Event Button-->
    <ui:button label="Save" press="{!c.createEvent}"/>
    
</aura:component>
Here is my JS Controller:
 
({
	createEvent : function(component, event, helper) {
    // Validate form fields
    // Pass form data to a helper function
    var newEvent = component.get("v.newEvent");
    helper.createEvent(component, newEvent);
}
})

Here is my Helper:
 
({
	createEvent: function(component, event) {
    //Save the event and update the view
    this.upsertEvent(component, event, function(a) {
        var events = component.get("v.events");
        
        events.push(a.getReturnValue());
        
        component.set("v.events", events);
       
    });
},
upsertEvent : function(component, event, callback) {
  var action = component.get("c.saveEvent");
  action.setParams({ 
      'event': event
  });
  if (callback) {
      action.setCallback(this, callback);
  }
  $A.enqueueAction(action);
}
})
Here is my Apex Controller:
public with sharing class EventController {
@AuraEnabled
    public static List<Event> getEvents() {
        String runningUser = UserInfo.getUserId();
        List<Event> events =  Database.query(
                'SELECT Id, Subject, WhoId, WhatId, EndDateTime, StartDateTime, Matter_Type__c, Color_Code__c, Type, Event_Type__c, OwnerId FROM Event WHERE OwnerId =  :runningUser AND (StartDateTime = LAST_N_DAYS:45 OR StartDateTime = NEXT_N_DAYS:45)');

        //Add isAccessible() check
        return events;
    }
    @AuraEnabled
    // Retrieve all primary contacts
    public static List<Event> getConsult() {
        List<Event> consultEvents = 
             [SELECT Id, Subject, WhoId, WhatId, EndDateTime, StartDateTime, ActivityDate, OwnerId, Type FROM Event WHERE Event_Type__c = 'Consult' AND OwnerId = '005j000000BRyZ1'];

        //Add isAccessible() check
        return consultEvents;
    }

  @AuraEnabled
public static Event saveEvent(Event event) {
    // Perform isUpdateable() check here 
    
   
    					
    upsert event;
    return event;
} 
    

  
    
}
The extra code in the controller is for another part of the app. It looks like the data is being passed to the Apex controller from the component and that the Apex controller is set up the same way as the example.

Any ideas on how to troubleshoot would be appreciated.


 
I've searched the forums high and low and I'm still not getting something right with this.  

My form loads and loads my records from the database.  The problem is when I try and go to "Create Camping Item" I get this error:

This page has an error. You might just need to refresh it. Action failed: c$campingList$controller$createCampingList [component is not defined] Failing descriptor: {c$campingList$controller$createCampingList}

Here's the code:

campingList.cmp
<aura:component controller="CampingListController">
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <aura:attribute name="newItem" type="Camping_Item__c" default="{'Name':'',
                                                                   'Quantity__c':0,
                                                                   'Price__c':0,
                                                                   'Packed__c':false,
                                                                   'sobjectType':'Camping_Item__c'}"/>
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <!-- NEW Campaing FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">
        
        
        <!-- [[ Campaing form goes here ]] -->
        
        <div aria-labelledby="newCampaingForm">
            
            <!-- BOXED AREA -->
            <fieldset class="slds-box slds-theme--default slds-container--small">
                
                <legend id="newCampaingForm" class="slds-text-heading--small 
                                                   slds-p-vertical--medium">
                    Add Expense
                </legend>
                
                <!-- CREATE NEW Campaing FORM -->
                <form class="slds-form--stacked">
                    
                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <ui:inputText aura:id="campingName" label="Camping Name"
                                          class="slds-input"
                                          labelClass="slds-form-element__label"
                                          value="{!v.newItem.Name}"
                                          required="true"/>
                        </div>
                    </div>
                    
                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <ui:inputNumber aura:id="quantity" label="Quantity"
                                            class="slds-input"
                                            labelClass="slds-form-element__label"
                                            value="{!v.newItem.Quantity__c}"
                                            required="true"/>
                            
                        </div>
                    </div>
                    
                    
                    
                    <div class="slds-form-element">
                        <div class="slds-form-element__control">
                            <ui:inputCurrency aura:id="price" label="Price"
                                              class="slds-input"
                                              labelClass="slds-form-element__label"
                                              value="{!v.newItem.Price__c}"/>
                        </div>
                    </div>
                    
                    <div class="slds-form-element">
                        <ui:inputCheckbox aura:id="packed" label="Packed ?"
                                          class="slds-checkbox"
                                          labelClass="slds-form-element__label"
                                          value="{!v.newItem.Packed__c}"/>
                    </div>
                    
                    <div class="slds-form-element">
                        <ui:button label="Create Camping Item"
                                   class="slds-button slds-button--brand"
                                   press="{!c.createCampingList}"/>
                    </div>
                    
                </form>
                <!-- / CREATE NEW EXPENSE FORM -->
                
            </fieldset>
            <!-- / BOXED AREA -->
            
        </div>
        <!-- / CREATE NEW EXPENSE -->
    </div>
    
    <!-- ITERATIING ITEM LISTS -->
    <div class="slds-card slds-p-top--medium">
        
        <c:campingHeader />
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="item">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>	
    <!-- / ITERATIING ITEM LISTS -->
 
    
</aura:component>

campingListController.js
({
	
    doInit  : function(component, event, helper) {
		var action = component.get("c.getItems");
        action.setCallback(this, function(response){
            var state = response.getState();
           
            if (component.isValid() && state === "SUCCESS") {
           
               
                component.set("v.items", response.getReturnValue());
                 
            }
        });
        
        $A.enqueueAction(action);
	},
    
    createCampingList : function(component, event, helper){
    	// If we pass error checking, do some real work
        if(helper.validateCampingForm(component)) {
            var newItem = component.get("v.newItem");
            helper.createItem(component, newItem);
        }
    }
})

campingListHelper.js
({
	
    doInit  : function(component, event, helper) {
		var action = component.get("c.getItems");
        action.setCallback(this, function(response){
            var state = response.getState();
           
            if (component.isValid() && state === "SUCCESS") {
           
               
                component.set("v.items", response.getReturnValue());
                 
            }
        });
        
        $A.enqueueAction(action);
	},
    
    createCampingList : function(component, event, helper){
    	// If we pass error checking, do some real work
        if(helper.validateCampingForm(component)) {
            var newItem = component.get("v.newItem");
            helper.createItem(component, newItem);
        }
    }
})

and last but not least, my Apex class, CampingListController.apxc
public with sharing class CampingListController {
    
    @AuraEnabled
    public static List<Camping_Item__c> getItems() {
        String[] fieldsToCheck = new String[] {
            'Id', 'Name', 'Quantity__c', 'Price__c', 'Packed__c', 'CreatedDate'};

        Map<String, Schema.SObjectField> fieldDescribeTokens = Schema.SObjectType.Camping_Item__c.fields.getMap();
        
        for(String field : fieldsToCheck) {
            if(! fieldDescribeTokens.get(field).getDescribe().isAccessible()){
                throw new System.NoAccessException();
                return null;
            }
        }
                
        //OK, they're cool, let 'em through
        return [SELECT Id, Name, Quantity__c, Price__c, Packed__c, CreatedDate FROM Camping_Item__c];
                
    }
    
    @AuraEnabled
    public static Camping_Item__c saveItem(Camping_Item__c item) {
        upsert item;
        return item;
    }

}

For the life of me I can't seem to figure out what is missing.  Any and all help will be deeply appreciated.  Thank you for your time!




 
Recently turned on the Enterprise Territory Management functionality and I'm trying to get the Apex Class setup and keep getting an error message. I've copied the example code from the Apex Developer Guide (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_TerritoryMgmt_OpportunityTerritory2AssignmentFilter.htm#apex_interface_TerritoryMgmt_OpportunityTerritory2AssignmentFilter) and it's not working.  

I keep getting the following error:


No such column 'Territory2Id' on entity 'Opportunity'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Hi,

I was recently reading through some of the Lightning UI component documentation and found what I believe to be an error in the documentation.

When describing an example controller, the documentation uses the line 
evt.source.get("v.label");
however when I use this example in my own org it will not get the source correctly. Instead using 
event.getSource().get('v.label')
will correctly get the label from the source. Can anyone advise me why this might be or if the functionality changed and the documentation wasn't updated?

Thanks
Hi Friends, 

So i have a requirment where i need to display all the component (objects, classes, pages, pagelayouts, workflows etc..) names, which exist in my org on a VF page.

Now this is pretty simple it was just an Page or an apex class where i can simply query the object and display the items on the VF page. The problem lies with getting info about workflows, email alerts, page layout etc. My question is how can i query the names of all these components from Apex it self? I know we can use Metadata API and all, but has anyone implemented this concept before or has a code snippet that i can look into? 

I know there are webservises involved. So could you guys please help me out here. Thanks. 
Hello everyone,
Is there any way to pass the value of an input text field in the vf page to lightning component, through a shared controller??

Thank You
Aakanksha Singh
Hello,

I am facing an issue with lightning--

When I click the escalation/transfer button on the case object in the sandbox I am hitting an error

"Something has gone wrong. [NoErrorObjectAvailable] Access Check Failed! AttributeSet.get(): attribute 'transferQueues' of component
' is not visible to 'markup://c:QueueTransfer" . Below is the definition of button.
 
var ticketId = "{!Case.Id}";
var userType = "{!User.UserTypeFormula__c}";
var targetUrl = "/c/TicketTransfer.app#main?caseId="+ticketId;
window.location = (userType == "PowerPartner" ? "/partners" : "") + targetUrl;
The lightning component:
 
<aura:application access="GLOBAL" controller="TaosTransferController">
  <ltng:require styles="/resource/slds/assets/styles/salesforce-lightning-design-system-ltng.css"/>

  <aura:attribute name="page" type="String"/>
  <aura:attribute name="queryParameters" type="String"/>
  <aura:attribute name="ticket" type="Case"/>
  <aura:attribute name="newOwnerId" type="String"/>
  <aura:attribute name="newOwnerName" type="String"/>
  <aura:attribute name="hwCategory" type="String"/>
  <aura:attribute name="hwComponents" type="String"/>
  <aura:attribute name="hwOtherComponent" type="String"/>
  <aura:attribute name="hwSymptoms" type="String"/>
  <aura:attribute name="hwMacAddress" type="String"/>
  <aura:attribute name="hwMfgNumber" type="String"/>

  <aura:handler action="{!c.doInit}" name="init" value="{!this}"/>
  <aura:handler action="{!c.locationChange}" event="aura:locationChange"/>
  <aura:handler action="{!c.updateSelectedOwner}" event="c:ownerSelectEvent"/>
  <aura:handler action="{!c.updateHardwareValues}" event="c:hardwareDataEvent"/>

  <div class="slds">
    <c:grid align="center" style="padding:5%">
      <c:col align="middle" lgSize="10-of-12" mdSize="10-of-12" size="1-of-1">
        <aura:renderIf isTrue="{!v.page == 'main'}">
          <c:TransferMain />
        </aura:renderIf>
        <aura:renderIf isTrue="{!v.page == 'hardware'}">
          <c:hardwareTransfer ticket="{!v.ticket}"/>
        </aura:renderIf>
        <aura:renderIf isTrue="{!v.page == 'confirm'}">
          <c:confirmationPage
            newOwnerId="{!v.newOwnerId}"
            newOwnerName="{!v.newOwnerName}"
            oldOwnerName="{!v.ticket.Owner.Name}"
            ticket="{!v.ticket}">
          </c:confirmationPage>
        </aura:renderIf>
      </c:col>
    </c:grid>
    <aura:if isTrue="{!v.page != 'confirm'}">
      <c:grid align="center">
        <aura:renderIf isTrue="{!and(v.page != 'hardware', v.page != 'main')}">
          <c:button press="{!c.goBack}" type="neutral">Go Back</c:button>
        </aura:renderIf>
      </c:grid>
    </aura:if>
  </div>

</aura:application>
QueueTransfer component
 
<aura:component controller="TaosTransferController">

  <aura:handler action="{!c.doInit}" name="init" value="{!this}"/>
  <aura:attribute name="partnerSite" type="Boolean"/>

  <!--comment test-->

  <div class="slds-form-element">
    <div aria-expanded="true" class="slds-picklist">
      <div class="slds-dropdown-trigger">
        <button aria-haspopup="true" class="slds-button slds-button--neutral
          slds-picklist__label">
          <span class="slds-truncate">Select a Queue</span>
          <c:svg class="slds-icon slds-icon--large" xlinkHref="/resource/slds/assets/icons/utility-sprite/svg/symbols.svg#groups"/>
        </button>
        <div class="slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu">
          <ul class="slds-dropdown__list" role="menu">
            <aura:iteration items="{!v.transferQueues}" var="opt">
              <li class="slds-dropdown__item" href="#confirm">
                <a class="slds-truncate" href="#confirm" id="{!opt.Id}" onclick="{!c.selectNewOwner}" role="menuitem" title="{!opt.Name}">
                  {!opt.Name}
               </a>
              </li>
            </aura:iteration>
            <aura:if isTrue="{!v.partnerSite == false}">
              <li class="slds-dropdown__item" href="#hardware">
                <a class="slds-truncate" href="#hardware" id="00G30000003evAX" onclick="{!c.selectNewOwner}" role="menuitem" title="Vecna Hardware Queue">
                  Vecna Hardware Queue
                </a>
              </li>
            </aura:if>
          </ul>
        </div>
      </div>
    </div>
  </div>

</aura:component>

The Apex Controller
 
public class TaosTransferController {

  private static User runningUser;
  private static Case ticket;
  private static List<Group> queueOptions;
  private static List<User> userOptions;

  @AuraEnabled
  public static User checkUser() {
    if(runningUser == null) {
      runningUser = [
        SELECT Id,Username,Email,FirstName,LastName,Profile.Name
        FROM User WHERE Id = :UserInfo.getUserId()
      ];
    }
    return runningUser;
  }

  @AuraEnabled
  public static Case getTicketInfo(String caseId) {
    if(ticket == null) {
      ticket = [SELECT Id,Owner.Name,Contact.Name,Vecna_Location__c,
      Vecna_Location__r.Vecna_Location_Address_1__c,Vecna_Location__r.Vecna_Location_City__c,
      Vecna_Location__r.Vecna_Location_State__c,Vecna_Location__r.Vecna_Location_Zip_Code__c
      FROM Case WHERE Id = :caseId LIMIT 1];
    }
    return ticket;
  }

  @AuraEnabled
  public static List<Group> getQueues() {
    User u = checkUser();
    List<String> queues = new List<String> {
      'Service Desk Queue','Vecna IT Queue','Vecna Night Escalation Queue','Paper Order Queue','BeneTravel Queue'};
    if(u.Profile.Name != 'Taos Community User') {
      queues.add('Pulse Holding Queue');
      queues.add('Performance Management Queue');
      queues.add('FujiFilm Tickets');
    }
    if(queueOptions == null) {
      queueOptions = [SELECT Id,Name FROM Group WHERE Name IN :queues];
    }
    return queueOptions;
  }

  @AuraEnabled
  public static List <User> getUsers() {
    if(userOptions == null) {
      User u = checkUser();
      if(u.Profile.Name == 'Taos Community User') {
        userOptions = [SELECT Id,Name FROM User WHERE Profile.Name = 'Taos Community User' ORDER BY Name];
      } else {
        userOptions = [
          SELECT Id,Name FROM User
          WHERE (IsActive = true AND UserRole.Name LIKE '%Client Support%') OR Profile.Name = 'Taos Community User'
          ORDER BY Name
        ];
      }
    }

    return userOptions;
  }

  @AuraEnabled
  public static void updateTicket(Case tkt, String comments, Integer paperCases, String oldOwnerName, String newOwnerName) {
    Escalation_Comment__c cmnt = new Escalation_Comment__c();
    cmnt.Comments__c = comments;
    cmnt.Ticket__c = tkt.Id;
    cmnt.From__c = oldOwnerName;
    cmnt.To__c = newOwnerName;
    Database.SaveResult commentResult = Database.insert(cmnt);

    if(commentResult.isSuccess()) {
      tkt.Paper_Cases_Requested__c = paperCases;
      Database.SaveResult ticketResult = Database.update(tkt);
    }
  }

}

Client Side Controller for TicketTransfer:
 
({

  doInit: function(component, event, helper) {

  },

  locationChange: function(component, event, helper) {
    component.set("v.page", event.getParam("token"));

    if (event.getParam("querystring")) {
      helper.handleQueryParameters(component, event);
    }
  },

  goBack: function(component) {
    component.set("v.newOwnerId", "");
    component.set("v.newOwnerName", "");
    window.history.back();
  },

  updateSelectedOwner: function(component, event) {
    component.set("v.newOwnerId", event.getParam("newOwnerId"));
    component.set("v.newOwnerName", event.getParam("newOwnerName"));
  },

  updateHardwareValues: function(component, event) {
    component.set("v.hwCategory", event.getParam("category"));
    component.set("v.hwComponents", event.getParam("components"));
    component.set("v.hwOtherComponent", event.getParam("otherComponent"));
    component.set("v.hwSymptoms", event.getParam("symptoms"));
    component.set("v.hwMacAddress", event.getParam("macAddress"));
    component.set("v.hwMfgNumber", event.getParam("mfgNumber"));
  }

})

Helper for TicketTransfer:
 
({
  handleQueryParameters: function(cmp, event) {

    var queryParams = event.getParam("querystring").split('=');

    if (queryParams.indexOf('caseId') > -1 && !cmp.get("v.ticket")) {
      var action = cmp.get("c.getTicketInfo");
      var id = queryParams[queryParams.indexOf('caseId') + 1];

      action.setParams({
        "caseId": id
      });

      action.setCallback(this, function(actionResult) {
        if (actionResult.getState() === "SUCCESS") {
          var ticket = action.getReturnValue();
          cmp.set("v.ticket", ticket);
        }
      });

      $A.enqueueAction(action);
    }

    if (event.getParam("querystring") === "hardware=true") {
      var hwCategory = cmp.get("v.hwCategory");
      var hwComponents = cmp.get("v.hwComponents");
      var hwOtherComponent = cmp.get("v.hwOtherComponent");
      var hwSymptoms = cmp.get("v.hwSymptoms");
      var hwMacAddress = cmp.get("v.hwMacAddress");
      var hwMfgNumber = cmp.get("v.hwMfgNumber");

      cmp.set("v.ticket.Hardware_Replacement_Category__c", hwCategory);
      cmp.set("v.ticket.Hardware_Replacement_Component__c", hwComponents);
      cmp.set("v.ticket.Other_Component_Info__c", hwOtherComponent);
      cmp.set("v.ticket.Symptoms_Issues__c", hwSymptoms);
      cmp.set("v.ticket.Old_Mac_Address__c", hwMacAddress);
      cmp.set("v.ticket.Old_MFG_Number__c", hwMfgNumber);
    }

  },

})

ClientSide Controller for QueueTransfer:
 
({

    doInit : function(component, event, helper) {
      helper.getQueues(component);
      if(window.location.pathname.indexOf('partners') === -1) {
        component.set("v.partnerSite", false);
      } else {
        component.set("v.partnerSite", true);
      }
    },

    selectNewOwner : function(component, event, helper) {
      var source =  (event.target ? event.target : event.srcElement);
      var newOwnerId = source.id;
      var newOwnerName = source.title;

      $A.get("e.c:ownerSelectEvent").setParams({
          newOwnerId: newOwnerId,
          newOwnerName: newOwnerName
      }).fire();
    }

})

Helper for QueueTransfer:
 
({
	
   getQueues : function(component,event) {
	  var a = component.get("c.getQueues");

	  a.setCallback(this, function(action) {
      if (action.getState() === "SUCCESS") {
        component.set("v.transferQueues", action.getReturnValue());
        var result = component.get("v.transferQueues");
      } else {
        alert(action.getState());
      }

	  });

	  $A.enqueueAction(a);
	},
})

I would appreciate if anyone can help me with this issue. Thanks a lot in advance !

Venkat


 
The new lighting doesn't allow you to create a Task or Notes which blows my mind why these options were removed.  I want to get back to the classic so i can create tasks and create notes.  

Any help would be appreciated.  Also tried to edit pages but it has not out buttion and you have to log out and go back in. 
Hi,
I'm having issues while previewing a Lightning Component using a Lightning App, via Developer Console. 
The next message is shown to me:
"Lightning Components require My Domain...". 
However, I have a My Domain already deployed.

Does anyone here know what is happening?

Regards!
Hi ,
I use an angular js app which is doing an ajax call on services/oauth2/token?code= endpoint but this fails and gives an error saying 
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://sunsso6.cloud.pcftest.com' is therefore not allowed access.
And when i tried a CORS plugin this worked but checking out for an actual solution so that it works without CORS plugin in chrome browser.

regards
Arun
I have added a VF page to a lightning app builder. I want to know how to pass a record id to the VF as URL PARAMETER. Please let me know asap.
At this point I'm spinning my wheels and need to call on the experts.  I am pulling a list of Strings from SOQL and trying to put them in a String List, but not matter what method I use I always seem to end up with "Illegal assignment from List to List."  Once the list is populated, I want to use it and loop through each value and query a table for records that have the value.  Basically a series of events occur for each value in the string list.  All of the posts on line seem to be saying I have a class of the same name (nope) or I'm using a field when I need a list or something.  None of that seems accurate.  So why else would I be getting this error?  I've tried a lot of different methods to do the list and they all work up to a point, but then I try to use the values and I hit a wall and that error pops up.  Help!

In an nutshell (not actual code)

List<String> test = [Query from System]

for(Integer i=0; i< test.size(); i++){
   for (List<Case> cas : [Query from System where field = test[i]]{
        for(Case c: cas){
           str += c.CaseNumber + ',' + c.CustomField__c;
    }
   //do something with str
  }
}
Hi Guys,

good day!

Just a newbie in here, can you assist me with below Apex Class I already made a Test Class and my Problem in the Test Class is the part of method  deleteOppContRole() wherein it doesn't covered any help please ?

public class OpportunityContactRoleController {
    
    public Id contRoleId {get; set;}
    public Id oppId;
    public Opportunity oppObj;
    public ApexPages.StandardController controller {get; set;}
    

    public List<OpportunityContactRole> oppContRoles {get; set;}
    
    public OpportunityContactRoleController(ApexPages.StandardController controller){
        this.oppObj = (Opportunity)controller.getRecord();
        oppId = this.oppObj.Id;
        
        oppContRoles = [SELECT Id,OpportunityId, Contact.Name, Contact.Email, Role, Contact.Account.Name, Contact.Phone, IsPrimary
                            FROM OpportunityContactRole WHERE OpportunityId = :((Opportunity)controller.getRecord()).Id];
        
    }
    
    public void deleteOppContRole(){
        if(contRoleId != null){
        OpportunityContactRole ocr = new OpportunityContactRole();
        ocr.Id = contRoleId;
        delete ocr;
        oppContRoles = new List<OpportunityContactRole>();
        
        oppContRoles = [SELECT Id,OpportunityId, Contact.Name, Contact.Email, Role, Contact.Account.Name, Contact.Phone, IsPrimary
                            FROM OpportunityContactRole WHERE OpportunityId = :((Opportunity)controller.getRecord()).Id];
        }
        
    }
    
   public pageReference primaryContact() {
     
       PageReference pageRef = Page.OpportunityPrimaryContact;
       pageRef.getParameters().put('Id', oppId);
       pageRef.setRedirect(true);
       
       return pageRef;
   }
    
}
Hello

Is there a way to update External object  record using Apex . I have to update external object record after creation a record in salesforce?