You need to sign in to do that
Don't have an account?
Saikiran Kolli
Apex Error message
Hi Every one when I'm adding success message Supplied quantity, it should be in the same page but sound must be produced, Could any one please help me. when im adding quantity its going to sound page public with sharing class OrderFulfill { map<string, string> lineItemNameMapWithQrcode=new map<String, String>(); // lineitemname, qrcode list<Order_Line_Items__c> UpdatedOrderLineItem=new list<Order_Line_Items__c>(); list<Order_Line_Items__c> UpdatedOrderLineItem1=new list<Order_Line_Items__c>(); set<String> changedItemIds=new set<String>(); set<String> lineItemName{Set;Get;} public String reccode{get;set;} public String SelectedBox{Set;Get;} public list<WrapOrderLineitemWithQrcode> lineitemlist{set;get;} public List<Orders__c> order {get;set;} List < Order_Line_Items__c > list1; public list<SelectOption> Boxoptions{set;get;} Public list<Order_Line_Items__c> orderItemsList{Set;Get;} public String olid{get;set;} public List<Order_Line_Items__c> olit{get;set;} Map<String, WrapOrderLineitemWithQrcode> WrapperMap=new Map<String, WrapOrderLineitemWithQrcode>(); // string is qrcode public OrderFulfill(){ Boxoptions=new list<SelectOption>(); lineItemName=new set<String>(); lineitemlist=new list<WrapOrderLineitemWithQrcode>(); orderItemsList=new list<Order_Line_Items__c>(); OrderLineItems(); //lineItemNameMapWithQrcode= String boxnm=''; Boxoptions.add(new SelectOption('--None--', '--None--')); for(integer i=1;i<=15;i++) { boxnm = 'Box '+i; Boxoptions.add(new SelectOption(boxnm, boxnm)); } } public void OrderLineItems(){ Set<id> oid = new Set<id>(); List < Order_Line_Items__c > listOfItems = new List < Order_Line_Items__c > (); order = [SELECT name, Total_supplied_quantity__c, Location__c, From_Date__c, To_Date__c, id, Status__c, Submitted_On__c, SystemModstamp, Total_Quantity__c, Total_Units__c FROM Orders__c Where Id = : apexPages.currentPage().getParameters().get('id') ]; for(Orders__c o : order) { oid.add(o.id); } /*list1 = [select id, name, Order__c, Quantity__c,Supplied_Quantity__c,Difference__c, Type__c from Order_Line_Items__c where Order__c = :order.id and Supplied_Quantity__c <= :0];*/ list1 = [select id, name, Order__c, Quantity__c,Supplied_Quantity__c,Difference__c,Compare__c, Type__c from Order_Line_Items__c where Order__c IN :oid AND Compare__c = 'false' and Type__C = 'subject']; for (Order_Line_Items__c oli: list1) { listOfItems.add(oli); lineItemName.add(oli.name); } for(QR_Codes__c qr: [Select Id, QR_Code__c,Name from Qr_Codes__c where name in: lineItemName]){ lineItemNameMapWithQrcode.put(qr.name, qr.qr_code__c); } for(Order_Line_Items__c oli: listOfItems) { if(lineItemNameMapWithQrcode.containskey(oli.name)) { lineitemlist.add(new WrapOrderLineitemWithQrcode(lineItemNameMapWithQrcode.get(oli.name), oli)); } } for(WrapOrderLineitemWithQrcode w: lineitemlist){ WrapperMap.put(w.qrcode, w); } } public list<WrapOrderLineitemWithQrcode> getListItem() { return WrapperMap.values(); } public pagereference refresh() { //reccode=''; if(SelectedBox=='' || SelectedBox==null || SelectedBox=='--None--') { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select Box to save')); } else if(WrapperMap.containsKey(reccode) && WrapperMap.get(reccode).OrdlItem.Quantity__c >=WrapperMap.get(reccode).OrdlItem.Supplied_Quantity__c) { if(WrapperMap.get(reccode).OrdlItem.Quantity__c == WrapperMap.get(reccode).OrdlItem.Supplied_Quantity__c){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'supplied quantity exceeded')); return null; } else WrapperMap.get(reccode).OrdlItem.Supplied_Quantity__c+=1; if(changedItemIds.add(WrapperMap.get(reccode).OrdlItem.Id)) { Order_Line_Items__c Ordlt=WrapperMap.get(reccode).OrdlItem; Ordlt.Select_Box__c = SelectedBox; UpdatedOrderLineItem.add(Ordlt); ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Confirm,'Quantity Added')); PageReference errorPage = new PageReference('/apex/sound'); errorPage.setRedirect(false); return errorPage; } } else ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'item not matched')); return null; } public PageReference updateme() { //refreshme(); if(UpdatedOrderLineItem.size()>0) { update UpdatedOrderLineItem; OrderLineItems(); } return new Pagereference('/apex/orderView?id='+order[0].id).setredirect(true); //return null; } public class WrapOrderLineitemWithQrcode { public string qrCode{Set;Get;} public Order_Line_Items__c OrdlItem{Set;Get;} public WrapOrderLineitemWithQrcode(String qrCode, Order_Line_Items__c OrdlItem) { this.qrCode = qrCode; this.OrdlItem = OrdlItem; } } }
There is no error, But at the line 111 When quantity added sound must be produced,
I added some javascript in one vf page its working there. when im using pagereference its not working. Sound is not coming only error message is coming.
in the vf page also near i tired using on complete, on submit but its not working
output will always show the output, I don't think this will get changed.
Refer below code :
Will it be possible for you to share your credentials or you whole code with me ?
Email : vineetkumar1988@gmail.com