• pentayah yuvraj
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I am always getting this error "ContactDetails$controller$locationChange [Cannot read property 'indexOf' of undefined] Failing descriptor: {ContactDetails$controller$locationChange}" Not sure what is wrong, can you please help

My component is 

<aura:component controller="ContactController">

    <aura:attribute name="contact" type="Contact" default="{'sobjectType': 'Contact'}"/>
    <aura:handler event="aura:locationChange" action="{!c.locationChange}"/>

    <div class="details">
        <h1>{!v.contact.Name}</h1>
        <h3>{!v.contact.Account.Name}</h3>
        <h3>{!v.contact.Title}</h3>
        <p>{!v.contact.Phone}</p>
        {!v.contact.MobilePhone}
    </div>

</aura:component>



and Controller is



({
    locationChange : function(component, event, helper) {
        
        var token=event.getParam("token");
        if(token.indexOf('contact/')===0)
        {
            var contactId=token.substr(token.indexOf('/')+1);
            var action=component.get("c.findById");
            action.setParams({"contactId":contactId});
        }
        action.setCallback(this,function(response){
            
            component.set("v.contacttt",response.getReturnValue());
        })
    $A.enqueueAction(action);
    }
})
This no longer works as described in the Trailhead.  Selecting "User with Limited Access to Treasures" on the CRUD & FLS Visualforce Demo tab yields an "insufficient access" error with no data returned.

Hi,

 

I have a simply query in my apex class to return a record from a custom object, code below:

 

userIncentivePlan = [select name, isActive__c, owner.name, Target__c, Growth_Incentive_Rate__c from Incentive_Plan__c where user__c =:UserId and isActive__c='True'];

 With the "isActive__c = 'True'" where criteria, the query fails to return any results, therefore I am assuming it  always evaluates to false. (also confirmed this by printing it out to a visual force page)

 

the formula on the field contains some nested if statements but always equates to 'True' or 'False', code below:

 

if (User__r.Profile.Name = 'System Administrator',  Incentive_Rate__r.isActive__c , 
if (User__r.Profile.Name = 'Corporate Sales Manager', Incentive_Rate__r.isActive__c, 
if (User__r.Profile.Name = 'Corporate Account Developer', Growth_Incentive_Rate__r.isActive__c, 
if (User__r.Profile.Name = 'Corporate Account Manager', Growth_Incentive_Rate__r.isActive__c, 
if (User__r.Profile.Name = 'Corporate Sales Super User', Incentive_Rate__r.isActive__c, 
if (User__r.Profile.Name = 'Account Development Manager', 
  if ( AND ( Incentive_Rate__r.isActive__c ='True',  Growth_Incentive_Rate__r.isActive__c ='True'), 'True', 'False'), 'False')
))))) 

The isActive__c field reference on the incentiveRate object is also a formula field [could that be the cause of the problem??]

 

Strangely, when I view the custom object record through salesforce, it evaluates correctly to 'True'

 

Having seen this forum posing, it suggests what I have done is correct : link

.... however it is not working. 

 

Any suggestions on how I can go about trying to resolve this would be appreciated.

 

Thanks in advance.

  • June 27, 2012
  • Like
  • 0