You need to sign in to do that
Don't have an account?
Rahul Agrawal 43
Advanced Apex Specialist Superbadge Step 7
Hi All,
While working on the Advanced Apex Specialist Superbadge Step 7 I am facing a weird issue.
The OrderExtension class is alreeady containing a variable of StandardSetController and in the OrderEdit page orderItemList is getting iterated.
But Salesforce doesn't support standardsetcontroller for OrderItem.
Hence getting the error: List controllers are not supported for OrderItem
Could anyone please help me, how to solve this issue.
Thanks,
While working on the Advanced Apex Specialist Superbadge Step 7 I am facing a weird issue.
The OrderExtension class is alreeady containing a variable of StandardSetController and in the OrderEdit page orderItemList is getting iterated.
But Salesforce doesn't support standardsetcontroller for OrderItem.
Hence getting the error: List controllers are not supported for OrderItem
Could anyone please help me, how to solve this issue.
Thanks,
Challenge Not yet complete... here's what's wrong: Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.
https://developer.salesforce.com/forums?id=9060G0000005O6OQAU
While working with step 2 , I am getting following error.
Challenge Not yet Complete....ensure that trigger call correct method .Can anybody help me find out issues with ordertrigger .
Thanks in advance
Hi Zachery,
I changed the reference of StandardListController to PriceBookeEntry but now showing the error to: Challenge Not yet complete... here's what's wrong: Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.
In the OrderQueryRecord method: I added a condition to fetch all active pricebookentries for the order item:
public static Order QueryOrderRecord(Id orderId){
SELECT Id, AccountId, EffectiveDate, Name, Status, Pricebook2Id,
(
SELECT Id, OrderId, Quantity, UnitPrice, PricebookEntryId, Product2Id,
Product2.Name, Product2.Family, Product2.Quantity_Remaining__c
FROM OrderItems where PricebookEntry.isActive = true
)
FROM Order WHERE Id = :orderId
Below I assigned StandardController to PriceBookeEntry
Constructor:
public OrderExtension(ApexPages.StandardController standardController){
orderRecord = (Order)standardController.getRecord();
orderItemMap = new Map<id,OrderItem>();
if ( orderRecord.Id != null ){
orderRecord = queryOrderRecord(orderRecord.Id);
}
orderItemList = new List<OrderItem>();
OrderItemList.addAll(orderRecord.OrderItems);
set<Id> p2ids = new set<Id>();
for(OrderItem oitem : OrderItemList){
p2ids.add(oitem.PriceBookEntryId);
}
List<PriceBookEntry> p2List = new List<PriceBookEntry>();
if(p2Ids.size()>0){
p2List = [select id from PriceBookEntry where id IN: p2Ids];
}
standardSetController = new ApexPages.StandardSetController(p2List);
standardSetController.setPageSize(Constants.DEFAULT_ROWS);
}
Still not able to fix this issue.
I suggest to inspect the Log inside the Developer Console and right click and click "View Raw Log" to see the anonymous apex code that is asserting your code.
You'll be able to check the errors. For example:
from the developer console:
13:04:31:053 EXCEPTION_THROWN [4]|System.AssertException: Assertion Failed: ext.getTotalPages() did not return the expected result.
and on Trailhead:
Challenge Not yet complete... here's what's wrong:
Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.
Could you share your order extension class, my pagination is not working fine, also in case of edit, do we need show existing product only?
Is GetOrderItems is a new method created by you and in this you are preparing list of order items based on pricebookentries in the current standardsetcontroller current records.
I'm getting: System.AssertException: Assertion Failed: ext.getHasNext() did not return the expected result.
When I check in the UI, it works fine, buttons are disabled in right momets.
My getHasNext() method: Any ideas?
Anyone can post the Apex class code here?
Make sure you have less than 15 products in trailhead org and check .Delete products manually if you have more than 15.you can get getTotalpages()working by having lessthan 15 which you confirm it in raw logs.You will no longer get error message "Ensure that you implement all the pagination methods using the corresponding StandardSetController methods."
Ensure that you implement all the pagination methods using the corresponding StandardSetController methods" please help
After clicking on check challenge, check your developer console debug logs, some assert condition must be failing if it is regarding gettotalpages() then check the count of pricebookentry records ideally it should be 12 and the number of pages should be 12/5 = 3. Delete any extra records.
I deleted all the extra products I created but I'm still facing this error :
Assertion Failed: ext.getHasNext() did not return the expected result.
Any piece of advice ?
Thanks a lot.
I'm facing issue in Advance Apex step 7 code.
Issue: Challenge Not yet complete... here's what's wrong:
Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.
can any body share all the code for step 7
For example query: should return 12 rows.