• sfdcbynite
  • NEWBIE
  • 50 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 34
    Replies

I have a controller extension which takes a StandardSetController. I have a list button on the Account list view.

And I am using person accounts. 

 

One of the fields in my view filter is based on a Contact field. But since it's a PersonAccount it shows up under the Account filters, as it should.

 

However when I call the getSelected() method in my controller I get the following error:

 

"core.apexpages.exceptions.ApexPagesHandledException: Object type not accessible. Please check permissions and make sure the object is not in development mode: and (Level__r.Name = 'Intermediate'))) ^ ERROR at Row:2:Column:6 Didn't understand relationship 'Level__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names." 

 

This makes perfect sense as the relationship should be Level__pr and not Level__r. But all this is happening in the getSelected() method which is a Standard method on the StandardSetController, So I have no access in order to properly format the query. This seems like a bug in SFDC to me.

 

Any suggestions? Preferably from somebody in SFDC tech support?

 

Here's a snippet of the code

 

public with sharing class StudentCourseBuilderController {

    private ApexPages.StandardSetController setcontroller;


    public PageReference bulkLoad() {
        List<Account> asts = setController.getSelected(); // FAILING HERE
        if(asts == null || asts.isEmpty())
            return null; //asts = [select id from Account limit 3];
        List<Contact> csts = [select id, accountId, internal_id__c, firstName, lastName, 
                    (select course_id__c from Course_Details__r order by course_id__c desc limit 1)
                    from Contact where accountId in :asts];

 

Until recently, whenever I would hit ctrl-S, not only would eclipse save my code locally, but it would also save to SFDC. A few days ago, for no reason I can see, it stopped. Now it just saves locally and I have to right-click - force.com - save to server which is a pain as it runs in the foreground, not the background, and it's more typing and clicks.

Anybody experienced such a problem? Solution? thanks.
Obj A has a m-d to child Obj B. On Obj A there is a roll-up summary field bSUM which sums up all field b's in all Obj B children. When the r.u.s filed bSUM updates (recalculates) a trigger is fired on Obj A. Now, this all works when I do actual record creation. But in my unit tests, the SOQL and asserts are getting called before the bSUM has updated, which means no trigger was fired yet and therefore the asserts fail. Anybody know what I can do to delay the assertions until the trigger has fired? My apologies if this post is not formatted properly. For some odd reason I no longer get the rich text editor.

 

I have a problem with my command link in the code below. Everytime I click on it just refreshes the page and does not go to the next page.

 

<apex:pageBlocktitle="Possible Personal Customer(s)"rendered="{!DisplayPosPersonalRecords == true && checkCustomer = 'No'}">

<apex:pageBlockTablevalue="{!ListPossiblePersonalRecords}"var="per"columnsWidth="5px, 5px"border="1">

 

<apex:columnheaderValue="Options">

  <apex:commandLinkvalue="Selectd"style="font-weight:bold;"action="{!SubmitNewContactMoveToOpp}">

    <apex:paramname="paccId"value="{!per.Id}"assignTo="{!SelectedId}"/>

    <apex:paramname="paccType"value="Ppersonal"assignTo="{!SelectedType}"/>

   </apex:commandLink>

</apex:column>

<apex:columnheaderValue="Customer Name"value="{!per.aName}"width="14.285%"/>

<apex:columnheaderValue="Equation No"value="{!per.EQ}"width="10%"/>

<apex:columnheaderValue="Email"value="{!per.Email}"width="14.285%"/>

<apex:columnheaderValue="Date of Bith"value="{!day(per.DoB)}/{!month(per.DoB)}/{!year(per.DoB)}"width="14.285%"/>

<apex:columnheaderValue="Address"value="{!per.Address}"width="14.285%"/>

<apex:columnheaderValue="Account Officer"value="{!per.AccountOfficer}"width="19.65%"/>

<apex:columnheaderValue="Created Date"value="{!per.CreDate}"width="14.285%"/>

</apex:pageBlockTable>

</apex:pageBlock>

 

 

I have even simplified my apex code so that it only returns the page and still no joy.

 

 

 

public PageReference SubmitNewContactMoveToOpp(){

 

return page.NewLoanOpp_Page_02;

 

}

 

 

Help...pulling my hair out!!

Hi All,

 

 Is it possible to update records on  force.com sites?

 

Thanks

Is it possible to (and if so how) to add apex methods to a custom Sobject? standard Sobject? Or do I need to create a child/wrapper class or utility class? Thanks, Dovid

We are creating a wizard that leads a user through a number of steps and based on their answer to each question will determine the next question.

 

Assuming I have created VF components to render each question and its only a matter of the logical flow (although this might be a good use case for Dynamic Visualforce Components) and I don't want to hard code the logic, what is the best way to store, parse and assemble the logical flow?

 

Should I create a custom object storing question answer, pointer to next question, or some sort of XML static resource or JSON, or something else?

 

Thanks for any suggestions people have,

Dovid

Hi

Tell me what is inputField and what is the use of the field.

Thanks

Anuraj

Hi,

 

How to integrate the google analytics with salesforce. Any one help me how to solve these.

 

Thanks,

Yamini.

one error is null id after insert

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, PopAccounttoPayment: execution of AfterInsert caused by: System.StringException: Invalid id: Trigger.PopAccounttoPayment: line 16, column 42: 

 

trigger PopAccounttoPayment on Payment_Line__c (after insert) {
set<ID> setInvID = new set<ID>();

        for(Payment_Line__c Pml : trigger.new){
                if(Pml.Invoice_BC__c != null || Pml.Invoice_BC__c != ''){
                        setInvID.Add(Pml.Invoice_BC__c);
                }
        }   
        
        Invoice_BC__c InvBC = new Invoice_BC__c();
        List<Invoice_BC__c> lstInvBC = [Select id,AccountID__c from Invoice_BC__c Where id in : setInvID];
            if(lstInvBC.size() != 0){
                InvBC = lstInvBC[0];
            }   
        if(InvBC.AccountID__c != null && InvBC.AccountID__c != ''){  
            Payment_Line__c pml = Trigger.new[0];   
            List<Payments__c> lstPm = new List<Payments__c>();
            Payments__c Pm = new Payments__c(id = pml.DocNo__c);
            Pm.AccountID__c = InvBC.AccountID__c;
            lstPm.Add(Pm);
        
            Update lstPm;
        }
}

 Test class

@isTest 
private class TestPopAccounttoPayment{
    static testMethod void myTest() {
    
      Account objAcc = new Account();
      objAcc.Name = 'test';
      insert objAcc;
        
      Opportunities__c objOpp = new Opportunities__c();
      objOpp.Account_Name__c = objAcc.Id;
      insert objOpp;
           
      Quotes__c objQuo = new Quotes__c();
      objQuo.Account_Name__c = objAcc.Id;
      objQuo.OpportunitiesID__c = objOpp.Id;
      insert objQuo;
                
      Sales_Order__c  objSOD = new Sales_Order__c();
      objSOD.Name = 'test4';
      objSOD.OpportunitiesID__c = objOpp.Id;
      objSOD.Quotes__c = objQuo.Id;
      insert objSOD;
      
      Invoice_BC__c  objInvBc = new Invoice_BC__c();
      objInvBc.Name = 'Test5';
      objInvBc.Sales_OrderID__c = objSOD.id;
      objInvBc.AccountID__c = objAcc.id;
      insert objInvBc;
      
      Payments__c objPay = new Payments__c();
      objPay.Name = 'Test2';
      objPay.Due_Date__c = System.Today();
      objPay.AccountID__c = objInvBc.AccountID__c;
      insert objPay;
      
      Test.StartTest();
      Payment_Line__c objPayLine = new Payment_Line__c();
      ApexPages.currentPage().getParameters().put('id', objPay.id);
      objPayLine.Name = 'Test3';
      objPayLine.DocNo__c = objPay.id;
      objPayLine.Invoice_BC__c = objInvBc.id;
      insert objPayLine;
           
      Payments__c objPay2 = new Payments__c();
      ApexPages.currentPage().getParameters().put('id', objPayLine.DocNo__c);
      objPay2.Name = 'Test2';
      objPay2.Due_Date__c = System.Today();
      objPay2.AccountID__c = objInvBc.AccountID__c;
      insert objPay2;
      update objPay2;
      Test.StopTest();
    
    }
}

 thank you so much

On a button click I want to call a method,perform some logic, and then call a pagereference (used elsewhere on the page as well) that then generates a redirect. Is it possible to call a PageReference from apex? If so what is the syntax to do so?

 

Thanks!

Maybe this is a silly question, but I have noticed many people have links to their twitter account or blog or images of their SFDC certifications.

 

How do you add that? I don't see any options under Preferences except for a text area for signature and when I tried to add HTML (for links) I got an invalid HTML and it wiped it out. Am I missing something?

 

Also, does anybody know what exactly is the criteria to change s person's status from "Visitor" to "Regular Contributor" to "Trusted Contributor"? I thought it was just a certain number of posts, but then I'll someone with more posts and a status of Visitor and somebody with less posts and a status of Regular Contributor? Just curious.

 

Thanks.

So, I have a trigger that retrieves a bunch of data from other objects and based on that updates a field on the record to be inserted, so I need a before insert trigger, right? right. But then I also need to create some junction objects between the inserted record and some other objects, so I need an after insert trigger. Now the idea of having to duplicate all of that code to do the fetching twice (I am talking performance here) does not give a warm fuzzy feeling. So anyone know a way I can generate the list of junction objects in the before trigger and store that list until the after trigger, add the missing ids, and insert? Or am I doomed to running through all this code twice? Thanks, Dovid

Hi, I imported 3059 records to a customer object I had created, after first importing a test set of data.  Both imports show as completed successfully in Monitoring Imports Queue, with the full set of reocrds listed, i.e. 180 for first test import then 3059 for second import.  However, when I go to the tab for the custom object created only 183 records are visible. 

 

I have tried adjusting the view to show all records but to no avail.  Does anyone have any ideas.  I initially had this in developmennt but have now deployed the C/Obj as I am happy with it.  But still no additional records.  Help anyone?