• Mythili
  • NEWBIE
  • 45 Points
  • Member since 2012
  • Salesforce Technical Consultant

  • Chatter
    Feed
  • 1
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 28
    Replies

I need to build a URL to call a standard account page from the selected account on a VF page.  I am getting to my class method, but my build of the URL is not correct. 

How do I build that pagereference?

 

  • April 24, 2013
  • Like
  • 0
Hi,
I have created a new custom button and added to "search reuslt" search layout.
This button appears in search results page in salesforce classic view whereas it is not appearing in lightning experience.
Any thoughts on this?

Thanks,
Mythili

Hi,
Can we have action.setCallback() inside another action.setCallBack()??
My code goes like this:

controller.js
doInit : function(cmp,event,helper){
//call apex server method1 
action1.setCallBack(this,function(response){
    console.log('INSIDE action1');
    if(state == "SUCCESS"){
      //call apex server method2
     action2.setCallBack(this,function(resp){
          console.log('INSIDE action2');
      });
   }
});
}

On executing this code, 'INSIDE action1' is getting logged whereas 'INSIDE action2' is not getting logged. But apex method2 is getting invoked and both the apex methods works fine. 
Can we have an action.setCallback() inside another action.setCallback()??

Thanks,
Mythili

Hi,
How to get the checkbox value (whether checked or unchecked) in controller(apex) from visualforce page? I should get this value in controller method as soon as I click the checkbox. Please note that the checkbox is displayed in page through wrapper class.
I currently use action:support in page and invoke the method from class on click of the checkbox but I am unable to get the checkbox's checked or unchecked value. I only get the checkbox's old value.
Any help is appreciated! Thanks.
Hi,
i am getting Challenge Not yet complete... here's what's wrong: 
The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked. error.
The description of  the challnege is :
Add a button to the campingListItem component that when clicked, marks the item as packed.
Add a button labeled "Packed!" that calls the packItem controller function when clicked.
The controller action marks the item attribute as packed, updates the item value provider and disables the button.

Though I get proper output, I am not able to solve this challenge. Not sure what they are expecting.
Any help is appreciated!!
 
  • September 19, 2016
  • Like
  • 0
I have nearly 300,000 account records in my org. I have the following class in my org:
global class testReadOnly{
@ReadOnly webservice static List getAcc()
{ return([select id from Account]); }
}
When I tried calling this method like testReadOnly.getAcc(); I get the following error:EXCEPTION: System.LimitException: Too many query rows: 50001
 Documentation says @ReadOnly returns upto 1 million rows. Please note that I have not performed any DML, sent emails or anything else in this transaction.
Can anyone tell me why am I getting the error even though I use @ReadOnly annotation. Thanks.
Hi,
I have enabled namespace in my dev org. Namespace name - LightningMyth.
When I write the following query in any class/trigger, I get the error : : Illegal assignment from List<Account> to List<LightningMyth.Account>
List<Account> acc=[SELECT ID FROM ACCOUNT limit 1];
but the same query works fine in workbench and QueryEditor.
When I changed the query to List<LightningMyth.Account> acc=[select id from LightningMyth.Account limit 1];
I get this error - Compile Error: First SObject of the FROM statement must be a valid SObject type.
I get this issue after enabling namespace and this issue is only with Account object, the SOQL with other standard and custom objects works just fine.
Any help is appreciated!
Is Aura, a javascript framework? What is Aura framework built of?
Hi,
I am using Eclispe with force.com IDE for developement purpose. We maintain our code version in Bitbucket. Hence I use Egit in eclipse to interact with Bitbucket and Git from Force.com IDE. When doing Git Pull operation from my remote repository(i.e from Bitbucket) the recent commits from Bitbucket gets pulled and it overrides the code in my eclispe. Because of this my code in eclipse gets overwritten. Any idea how do we handle this?
Lightning components are not visible in Android phones. when will it be available? any idea?
Lightning components are not visible in Android phones. when will it be available? any idea?

Hi,
Can we have action.setCallback() inside another action.setCallBack()??
My code goes like this:

controller.js
doInit : function(cmp,event,helper){
//call apex server method1 
action1.setCallBack(this,function(response){
    console.log('INSIDE action1');
    if(state == "SUCCESS"){
      //call apex server method2
     action2.setCallBack(this,function(resp){
          console.log('INSIDE action2');
      });
   }
});
}

On executing this code, 'INSIDE action1' is getting logged whereas 'INSIDE action2' is not getting logged. But apex method2 is getting invoked and both the apex methods works fine. 
Can we have an action.setCallback() inside another action.setCallback()??

Thanks,
Mythili

Hi,
How to get the checkbox value (whether checked or unchecked) in controller(apex) from visualforce page? I should get this value in controller method as soon as I click the checkbox. Please note that the checkbox is displayed in page through wrapper class.
I currently use action:support in page and invoke the method from class on click of the checkbox but I am unable to get the checkbox's checked or unchecked value. I only get the checkbox's old value.
Any help is appreciated! Thanks.
Hello,

In the past week or so we have been experiencing problems with multiple users of our app getting a error :
onErrorSfdc: {"readyState":4,"responseText":"[{\"message\":\"Your query request was running for too long.\",\"errorCode\":\"QUERY_TIMEOUT\"}]","status":400,"statusText":"Bad Request"}
The wierd thing is that we have not done anything differently app wise in the last three years, our app has not undergone any updates or upgrades and the phones they are run on are the same type of phones they have always run on. None of our login procedures have changed, and our number of app users has not increased in over 10 months.  Initially there is a large percentage of our users telling us the data is unavailable, then after some time they are finally able to pull the data they need down. Is there something going on with our database that is making the search go on for too long? did some limit change, do we need to revisit our code, or do something regarding our database on your side?
 
Hello,

I'm having difficultly with a trigger that we are running in our instance of salesforce. It runs perfectly in test, but gives me an error in production. I didn't write this, so I was hoping that someone with more experiance than I have could help me figure out where the error is, and what I need to do to fix it. Any help would be appreciated!

Thanks,

Ryan

The error that I recieve is:
NVMTaskTrigger: execution of AfterUpdate
 
caused by: System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop
 
Class.ActivityUtils.updateActivityHistory: line 75, column 1
Class.ActivityUtils.updateAccountActivityCount: line 28, column 1
Trigger.NVMTaskTrigger: line 9, column 1

Trigger:
trigger NVMTaskTrigger on Task (after insert, after update, after delete, after undelete) {
     
    sObject[] triggerRecords;
    if(!trigger.isDelete) triggerRecords = trigger.new;
    else triggerRecords = trigger.old;
     
    //Update Open Activity Count
    ActivityUtils au = new ActivityUtils(triggerRecords);
    au.updateAccountActivityCount();
    au.updateContactActivityCount();
    au.updateLeadActivityCount();
    au.updateOpportunityActivityCount();
    au.updateCaseActivityCount();
}

Class:
public class ActivityUtils {
     
    //config
     
    String fieldToUpdate = 'NVM_Activities__c'; //this field must be added to each object we're updating
    String fieldOpenToUpdate = 'Open_Activity_Count__c'; //this field must be added to each object we're updating
     
    //state
    set<id> accountIds;
    set<id> contactIds;
    set<id> opportunityIds;
    set<id> leadIds;
    set<id> caseIds;
     
    public ActivityUtils(sObject[] records) {
        accountIds = new set<id>();
        contactIds = new set<id>();
        opportunityIds = new set<id>();
        leadIds = new set<id>();
        caseIds = new set<id>();
        captureWhatAndWhoIds(records);
        addAccountIdsFromRlatedObjects();
    }
     
    public void updateAccountActivityCount() {
        if(accountIds.size() == 0) return;
        updateActivityCount('Account','WhatId', getStringFromIdSet(accountIds));
         updateActivityHistory('Account','WhatId', getStringFromIdSet(accountIds));
         
         
    }
    public void updateContactActivityCount() {
        if(contactIds.size() == 0) return;
        updateActivityCount('Contact','WhoId', getStringFromIdSet(contactIds));
                updateActivityHistory('Contact','WhoId', getStringFromIdSet(contactIds));
 
    }
    public void updateOpportunityActivityCount() {
        if(opportunityIds.size() == 0) return;
        updateActivityCount('Opportunity','WhatId', getStringFromIdSet(opportunityIds));
                updateActivityHistory('Opportunity','WhatId', getStringFromIdSet(opportunityIds));
 
    }
    public void updateLeadActivityCount() {
        if(leadIds.size() == 0) return;
        updateActivityCount('Lead','WhoId', getStringFromIdSet(leadIds));
                updateActivityHistory('Lead','WhoId', getStringFromIdSet(leadIds));
 
    }
    public void updateCaseActivityCount() {
        if(caseIds.size() == 0) return;
        //updateActivityCount('Case','WhoId', getStringFromIdSet(caseIds));
        //updateActivityHistory('Case','WhoId', getStringFromIdSet(caseIds));
 
    }
    private void updateActivityCount(String objToUpdate, String queryFld, String updateIds) {
        string strQuery = 'SELECT Id, (SELECT Id FROM OpenActivities) FROM ' + objToUpdate + ' WHERE Id IN (' + updateIds + ')';
        sObject[] sobjects = new list<sobject>();
        for(sObject so : database.query(strQuery)) {
            OpenActivity[] oActivities = so.getSObjects('OpenActivities');
            Integer openActivityCount = oActivities == null ? 0 : oActivities.size();
            sObject obj = createObject(objToUpdate, so.Id);
            obj.put(fieldOpenToUpdate, openActivityCount);
            sobjects.add(obj);
            system.debug('openActivityCount: ' + openActivityCount);
        }
        update sobjects;
    }
      
    private void updateActivityHistory(String objToUpdate, String queryFld, String updateIds) {
        string strQuery = 'SELECT Id, (SELECT Id FROM ActivityHistories) FROM ' + objToUpdate + ' WHERE Id IN (' + updateIds + ')';        
System.debug(strQuery);
        sObject[] sobjects = new list<sobject>();
        for(sObject so : database.query(strQuery)) {
            ActivityHistory[] oActivities = so.getSObjects('ActivityHistories');
            Integer closedActivityCount = oActivities == null ? 0 : oActivities.size();
            sObject obj = createObject(objToUpdate, so.Id);
            obj.put(fieldToUpdate, closedActivityCount);
            sobjects.add(obj);
            system.debug('ActivityHistoryCount: ' + closedActivityCount);
        }
        update sobjects;
    }
     
    private void captureWhatAndWhoIds(sObject[] objects) {
        for(sObject o : objects) {
            Id whatId = (Id)o.get('WhatId');
            Id whoId = (Id)o.get('WhoId');
            if(whatId != null) {
                String objectName = getObjectNameFromId(whatId);
                if(objectName == 'account') accountIds.add(whatId);
                if(objectName == 'opportunity') opportunityIds.add(whatId);
            }
            if(whoId != null) {
                String objectName = getObjectNameFromId(whoId);
                if(objectName == 'contact') contactIds.add(whoId);
                if(objectName == 'lead') leadIds.add(whoId);
            }
        }
    }
     
    private void addAccountIdsFromRlatedObjects() {
        for(Opportunity o : [SELECT AccountId FROM Opportunity WHERE Id IN :opportunityIds]) accountIds.add(o.AccountId);
        for(Contact c : [SELECT AccountId FROM Contact WHERE Id IN :contactIds]) accountIds.add(c.AccountId);
    }
     
    private String getObjectNameFromId(Id objId) {
        String preFix = String.valueOf(objId).left(3).toLowercase();
        if(prefix == '001') return 'account';
        if(prefix == '003') return 'contact';
        if(prefix == '006') return 'opportunity';
        if(prefix == '00q') return 'lead';
        //if(prefix == '500') return 'case';
        return '';
    }
     
    private String getStringFromIdSet(set<id> idSet) {
        string idString = '';
        for(Id i : idSet) idString+= '\'' + i + '\',';
        return idString == '' ? idString : idString.left(idString.length()-1); //If idString contains some ids we want to ensure we strip out the last comma
    }
     
    //The main part of the method below was taken from //Taken from http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_dml.htm
    //However we've modified this to accept an object id
    private sObject createObject(String typeName, Id objId) {
        Schema.SObjectType targetType = Schema.getGlobalDescribe().get(typeName);
        if (targetType == null) {
            // throw an exception
        }
         
        // Instantiate an sObject with the type passed in as an argument
        //  at run time.
        return targetType.newSObject(objId);
    }
     
}
Hi everyone, I need your help to solve this problem:

When execute this simple query:
SELECT Id, Persona__c FROM Ciclo_UPAEP__c WHERE Matricula__c = '48700486'  in the Force.com Explorer i get this error:
[FaultEvent fault=[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032" errorID=2032]. URL: https://na2.salesforce.com/services/Soap/u/19.0/00D400000007i7H?1000.8785103652626"] messageId="6CA03474-374E-84EB-93D5-DDE8B36CCC5D" type="fault" bubbles=false cancelable=true eventPhase=2]

Does anyone knows what does it means?

Thanks
 
Hi,
i am getting Challenge Not yet complete... here's what's wrong: 
The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked. error.
The description of  the challnege is :
Add a button to the campingListItem component that when clicked, marks the item as packed.
Add a button labeled "Packed!" that calls the packItem controller function when clicked.
The controller action marks the item attribute as packed, updates the item value provider and disables the button.

Though I get proper output, I am not able to solve this challenge. Not sure what they are expecting.
Any help is appreciated!!
 
  • September 19, 2016
  • Like
  • 0
I have nearly 300,000 account records in my org. I have the following class in my org:
global class testReadOnly{
@ReadOnly webservice static List getAcc()
{ return([select id from Account]); }
}
When I tried calling this method like testReadOnly.getAcc(); I get the following error:EXCEPTION: System.LimitException: Too many query rows: 50001
 Documentation says @ReadOnly returns upto 1 million rows. Please note that I have not performed any DML, sent emails or anything else in this transaction.
Can anyone tell me why am I getting the error even though I use @ReadOnly annotation. Thanks.
Hi,
I have enabled namespace in my dev org. Namespace name - LightningMyth.
When I write the following query in any class/trigger, I get the error : : Illegal assignment from List<Account> to List<LightningMyth.Account>
List<Account> acc=[SELECT ID FROM ACCOUNT limit 1];
but the same query works fine in workbench and QueryEditor.
When I changed the query to List<LightningMyth.Account> acc=[select id from LightningMyth.Account limit 1];
I get this error - Compile Error: First SObject of the FROM statement must be a valid SObject type.
I get this issue after enabling namespace and this issue is only with Account object, the SOQL with other standard and custom objects works just fine.
Any help is appreciated!