You need to sign in to do that
Don't have an account?
problem with select in standard controller
Hi,
our sales and I'm too, are finding hard to use Opportunities and Opportunities Products, becuase:
1. when select the products and changing search or page, all the selected products are lost
1.1. each search shows max 25 products.
2. While selecting the products there's no 'window' showing the already selected products
3. If a/some products are already selected and click again add products, the already selected product appear in the selecteable lists and it is actually possible to duplicate records.
Anyone else facing the same situation ?
I'm therefore creating something similar using custom objects.
as of now I was able to create something which is very similar to the Opportunities Products, now in order to show the already selected products and make sure these do not appear again in the list of products to be selected I'm creating a set of Ids for the items already selected.
//Get a set of tests alerady associated to the Object Set<ID> seltestIDSet = seltestset();
and
Private Set<ID> seltestset(){ Set<ID> seltestIDSet = new Set<ID>(); String stqry = 'Select st.name, st.Testing_Item__c, st.Id From Tests_to_run__c st Where st.Software_Testing__c = :o.id Order By st.Name'; for (Tests_to_run__c st : Database.query(stqry)){ seltestIDSet.add(st.Testing_Item__c);} return seltestIDSet; }
now the issue I have is the o.id, where I get Variable not defined.
well actually o is defined in the costructor :
private ApexPages.StandardController controller; // constructor private final Software_Testing__c o; public TestSearchController(ApexPages.StandardController stdController) { this.o = (Software_Testing__c)stdController.getRecord(); }
funny thing is I'm using the same o.id (variable) when saving the records:
//The list of Tests to Run records to insert list <Tests_to_run__c> test2runList = new list <Tests_to_run__c>(); for (TestWrapper cw : selectedTests) { test2runList.add(new Tests_to_run__c (Software_Testing__c = o.id, Testing_Item__c = cw.cat.id, Compulsory__c = cw.cat.Def_Compulsary__c, Assigne_to_User__c = cw.cat.Def_Functionality_Owner__c)); } if (test2runList.size() > 0) { insert test2runList; } controller = new ApexPages.StandardController(o); return controller.view();
And there I did not get any error.
Any suggestion ?
Thanks
Alex
I'm guessing this is because the method in which you get variable not defined is a 'static' method, whereas the variable is not.
Or actually, you've defined the variable as final !
You cannot assign a value / change the value of final variables.