function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saikiran KolliSaikiran Kolli 

Apex Error Message, unable to get sound


Hi,

Sound must be produced at the time of error message and it should be in the same page

In this scenario I'm scanning books , when I scan wrong book or extra books I'm getting error message.

At the time of error message sound must be produced and again scanning must be continued.

I'm getting the sound but its redirecting to sound page. 

Please help me
public pagereference refresh()
    {
          
       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'));
                          
                          
                PageReference sound = new PageReference('/apex/sound');
                sound.setredirect(false);
            
                      
                }
                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'));
                    
                    
                }
        }
       else
          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'item not matched')); 
      
 PageReference sound = new PageReference('/apex/sound');
 sound.setredirect(false);
 return null;
  
    }