• Jyotirmaya Rath 10
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hello,
 I want to create a button click event. SO when  I click on a button, it should show me the data(Like Ownername, OrderNumber etc) from current opportunity. How should I do that. As I am new the salesforce. I dont know how should I proceed 
I have a custom object Order__c with fields Tables__c(Table No) and Status__c(Picklist-In Progress/Completed). 
Another object Table__c having table no.
In the first page i have a lookup saying enter table number.....once i select a table no. and click next then from Order__c object i want to check if there is a record in custom order object with the table no. which i selected and status is equal to "In Progress".
if yes I want to store the existing order id in a variable 'existingorderid' and pass it in URL.
if no then set the existing order id as null.
Code-:
public with sharing class ctr_firstController {
 
       Public String tout { get; set;}
       Public String tablen{get;set;}
       Public  Tables__c  Table{get;set;}
       Public  Tables__c  Table1{get;set;}
       
       Public List<Order__c> eoid{get;set;}
       Public String exoid {get;set;}
       public String existingorderid {get;set;}
       
    public  ctr_firstController(){        
       Table = new Tables__c();
             
   }
   
   public Tables__c getTables() {
        return Table1;
    }

    public PageReference go() {
        
        String tableno =Table.TablesLU__c; 
       Table1 =  [select id, Name, Reserved__c from Tables__c where id=:tableno limit 1];
       Table1.Reserved__c= True;
       update Table1;
       
       eoid = [select id, name, Tables__c ,Status__c from Order__c where Tables__c=:Table1.Name and Status__c=:'In Progress' limit 1];
       if(eoid.size()>0)
           existingorderid = eoid[0].id;
       else
           existingorderid = null;

        pagereference ref = new pagereference('/apex/vfp_Home?exoid='+existingorderid+'&tablen='+tableno+'&tout=false');
        ref.setredirect(true);
        return ref;
        
        
    }




WHEN I AM USING THIS CODE ,THE NEXT PAGE URL IS SHOWING(exoid=null) instead of showing the id
https://c.cs58.visual.force.com/apex/vfp_Home?exoid=null&tablen=a050l000000FyRAAA0&tout=false
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG