• Mohammad Anzar
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 5
    Questions
  • 4
    Replies
Error : Invalid Type : opps__c in Apex code
Here opps is a custom object, i replace this one with standard , but also i get same error invalid type. 
I fetch the data from 3 objects where the name field value is given by me. If i delete the 3rd object i got the result. Why Its not work on 3 objects. 
Plz Help me guys to overcome this problem.

Visual force Page :


<apex:page controller="apmult" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title=" Enter the Value">
                <apex:outputText value=" Enter Name "></apex:outputText>
                <apex:inputText value="{!aname}"/>
                <apex:commandButton value=" SUBMIT " action="{!save}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title=" Display Account Records ...{!lac}">
                <apex:pageBlockTable value="{!arecs}" var="item">
                <apex:column value="{!item.id}"/>
                <apex:column value="{!item.name}"/>
                <apex:column value="{!item.phone}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title=" Display Lead Records ...{!llc}">
                <apex:pageBlockTable value="{!lrecs}" var="item">
                <apex:column value="{!item.id}"/>
                <apex:column value="{!item.name}"/>
                <apex:column value="{!item.phone}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title=" Display Oops Records ...{!loc}">
                <apex:pageBlockTable value="{!orecs}" var="item">
                <apex:column value="{!item.id}"/>
                <apex:column value="{!item.name}"/>
                <apex:column value="{!item.phone}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
          </apex:pageBlock>
       </apex:form>
</apex:page>

APEX CODE :

public class apmult {
    public string aname{set;get;}
    public list<account> arecs{set;get;}
    public list<lead> lrecs{set;get;}
    public list<opps__c> orecs{set;get;}
    
    public integer lac{set;get;}
    public integer llc{set;get;}
    public integer loc{set;get;}
    
    public void save(){
        arecs=[select id,name,phone from account where name=:aname];
        
        lac=arecs.size();
        
        lrecs=[select id,name,phone from lead where name=:aname];
        
        llc=lrecs.size();
        
        orecs=[select id,name,phone from account where name=:aname];
        
        loc=orecs.size();
    }

}
Does Open CTI works in community ? I couldn't find anything in the documentation of Open CTI right now. Any help will be appreciated.
Why @AuraEnabled methods are static ? 
While creating a task when we click on the lookup icon of assigned-to pop up appears where we can search for user and also assign the task to multiple users or groups. But when I made a vf page those options are missing, there is only search bar. When clicked from task layout the option comes.

User-added image

When clicked from vf page options are not coming.

User-added image

Any help will be appreciated.
Can user in a profile customize the tab sequence in lightning, because in lightning app is assigned to a profile but what about the users if they want to customize the tabs according to themselves. 

I am creating a wizard for Opportunity, Quote and QuoteLineItems. I am getting this error STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: [] while creating QuoteLineItems..

public class WizardClass 
{
    public Opportunity Oppo{get;set;}
    public List<Quote> quoteList{get;set;}
    public List<QuoteLineItem> quoteLineItemList{get;set;}
    public List<Quote> newQuoteList{get;set;}
    
    public WizardClass()
    {
        Oppo = new Opportunity();
        quoteList = new List<Quote>();
        quoteList.add(new quote());
        quoteLineItemList = new List<QuoteLineItem>();
        quoteLineItemList.add(new QuoteLineItem());
        }
    
    public void CreateQuote()
    {
        quoteList.add(new quote());
        }
        
    public void CreateQuoteLineItem()
    {
        quoteLineItemList.add(new QuoteLineItem());
        }
    
    public PageReference QuotePage()
    {
        return Page.OppoQuotes;
        }
         
       
    public PageReference Create()
    {
        
        insert Oppo; 
        List<Quote> quoList = new List<Quote>();
        for(Quote q : quoteList)
        {
            Quote quo = new Quote();
            quo.OpportunityId = Oppo.id;
            quo.name = q.name;
            quoList.add(quo);
            }
       // q.OpportunityId = Oppo.id;
        insert quoList;
        newQuoteList = quoList;
        PageReference newPage = new PageReference('/apex/OppoQuoteLine');
        return newPage;
        }
                
     public PageReference QuoteLineItemPage()
     {
       // Map<String,Quote> mapping = new Map<String,Quote>([Select id, name, (Select id, name From QuoteLineItem) From Quote]);
        List<QuoteLineItem> qliList = new List<QuoteLineItem>();
        Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true );
        insert pb;
        Product2 prod = new Product2(Name = 'SLA: Bronze', IsActive = true);
        insert prod;
        PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 1000, IsActive = true);
        insert pbe;
        for(Quote q : newQuoteList)
        {
           for(quoteLineItem qli : quoteLineItemList)
           {
            QuoteLineItem qliObj = new QuoteLineItem();
            qliObj.QuoteId= q.id;
            qliObj.PriceBookEntryId = pbe.id;
            qliList.add(qli);
               }
            }      
        
        insert qliList;
        PageReference pg = new PageReference('/'+oppo.id);
        return pg;
        }           
                
}

<apex:page controller="WizardClass">
  <apex:form >
     <apex:sectionHeader title="OppoQuoteLine"/> 
        <apex:pageBlock >
           <apex:repeat value="{!quoteList}" var="row">
               <apex:outputField value="   {!row.name}" style="font-family :Arial, font-size : 12px" />
               <!--apex:repeat value="{!qliList}" var="r"-->
               <apex:pageBlockSection columns="1">
                  <apex:pageBlockTable var="row" value="{!quoteLineItemList}" id="pgt">
                      <!--apex:column headerValue="Price Book Entry">
                          <apex:inputField value="{!row.PriceBookEntryId}"/>
                      </apex:column-->
                      <!--apex:column headerValue="Quote Name">
                          <apex:inputField value="{!row.QuoteId}"/>
                      </apex:column-->
                      <apex:column headerValue="Sales Price">
                          <apex:inputField value="{!row.UnitPrice}"/>
                      </apex:column>
                      <apex:column headerValue="Quantity">
                          <apex:inputField value="{!row.Quantity}"/>
                      </apex:column>
                      <!--apex:column headerValue="Product">
                          <apex:inputField value="{!row.Product2Id}"/>
                      </apex:column-->
                  </apex:pageBlockTable>
              <apex:commandButton action="{!CreateQuoteLineItem}" value="Add Row" immediate="true" reRender="pgt"/>
              
               </apex:pageBlockSection>
               <!--/apex:repeat-->
           </apex:repeat>
           <apex:pageBlockButtons >           
                  <apex:commandButton action="{!QuoteLineItemPage}" value="Save"/>
           </apex:pageBlockButtons>
        </apex:pageBlock>
  </apex:form>
</apex:page>
Error : Invalid Type : opps__c in Apex code
Here opps is a custom object, i replace this one with standard , but also i get same error invalid type. 
I fetch the data from 3 objects where the name field value is given by me. If i delete the 3rd object i got the result. Why Its not work on 3 objects. 
Plz Help me guys to overcome this problem.

Visual force Page :


<apex:page controller="apmult" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title=" Enter the Value">
                <apex:outputText value=" Enter Name "></apex:outputText>
                <apex:inputText value="{!aname}"/>
                <apex:commandButton value=" SUBMIT " action="{!save}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title=" Display Account Records ...{!lac}">
                <apex:pageBlockTable value="{!arecs}" var="item">
                <apex:column value="{!item.id}"/>
                <apex:column value="{!item.name}"/>
                <apex:column value="{!item.phone}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title=" Display Lead Records ...{!llc}">
                <apex:pageBlockTable value="{!lrecs}" var="item">
                <apex:column value="{!item.id}"/>
                <apex:column value="{!item.name}"/>
                <apex:column value="{!item.phone}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title=" Display Oops Records ...{!loc}">
                <apex:pageBlockTable value="{!orecs}" var="item">
                <apex:column value="{!item.id}"/>
                <apex:column value="{!item.name}"/>
                <apex:column value="{!item.phone}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
          </apex:pageBlock>
       </apex:form>
</apex:page>

APEX CODE :

public class apmult {
    public string aname{set;get;}
    public list<account> arecs{set;get;}
    public list<lead> lrecs{set;get;}
    public list<opps__c> orecs{set;get;}
    
    public integer lac{set;get;}
    public integer llc{set;get;}
    public integer loc{set;get;}
    
    public void save(){
        arecs=[select id,name,phone from account where name=:aname];
        
        lac=arecs.size();
        
        lrecs=[select id,name,phone from lead where name=:aname];
        
        llc=lrecs.size();
        
        orecs=[select id,name,phone from account where name=:aname];
        
        loc=orecs.size();
    }

}

I am creating a wizard for Opportunity, Quote and QuoteLineItems. I am getting this error STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: [] while creating QuoteLineItems..

public class WizardClass 
{
    public Opportunity Oppo{get;set;}
    public List<Quote> quoteList{get;set;}
    public List<QuoteLineItem> quoteLineItemList{get;set;}
    public List<Quote> newQuoteList{get;set;}
    
    public WizardClass()
    {
        Oppo = new Opportunity();
        quoteList = new List<Quote>();
        quoteList.add(new quote());
        quoteLineItemList = new List<QuoteLineItem>();
        quoteLineItemList.add(new QuoteLineItem());
        }
    
    public void CreateQuote()
    {
        quoteList.add(new quote());
        }
        
    public void CreateQuoteLineItem()
    {
        quoteLineItemList.add(new QuoteLineItem());
        }
    
    public PageReference QuotePage()
    {
        return Page.OppoQuotes;
        }
         
       
    public PageReference Create()
    {
        
        insert Oppo; 
        List<Quote> quoList = new List<Quote>();
        for(Quote q : quoteList)
        {
            Quote quo = new Quote();
            quo.OpportunityId = Oppo.id;
            quo.name = q.name;
            quoList.add(quo);
            }
       // q.OpportunityId = Oppo.id;
        insert quoList;
        newQuoteList = quoList;
        PageReference newPage = new PageReference('/apex/OppoQuoteLine');
        return newPage;
        }
                
     public PageReference QuoteLineItemPage()
     {
       // Map<String,Quote> mapping = new Map<String,Quote>([Select id, name, (Select id, name From QuoteLineItem) From Quote]);
        List<QuoteLineItem> qliList = new List<QuoteLineItem>();
        Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true );
        insert pb;
        Product2 prod = new Product2(Name = 'SLA: Bronze', IsActive = true);
        insert prod;
        PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 1000, IsActive = true);
        insert pbe;
        for(Quote q : newQuoteList)
        {
           for(quoteLineItem qli : quoteLineItemList)
           {
            QuoteLineItem qliObj = new QuoteLineItem();
            qliObj.QuoteId= q.id;
            qliObj.PriceBookEntryId = pbe.id;
            qliList.add(qli);
               }
            }      
        
        insert qliList;
        PageReference pg = new PageReference('/'+oppo.id);
        return pg;
        }           
                
}

<apex:page controller="WizardClass">
  <apex:form >
     <apex:sectionHeader title="OppoQuoteLine"/> 
        <apex:pageBlock >
           <apex:repeat value="{!quoteList}" var="row">
               <apex:outputField value="   {!row.name}" style="font-family :Arial, font-size : 12px" />
               <!--apex:repeat value="{!qliList}" var="r"-->
               <apex:pageBlockSection columns="1">
                  <apex:pageBlockTable var="row" value="{!quoteLineItemList}" id="pgt">
                      <!--apex:column headerValue="Price Book Entry">
                          <apex:inputField value="{!row.PriceBookEntryId}"/>
                      </apex:column-->
                      <!--apex:column headerValue="Quote Name">
                          <apex:inputField value="{!row.QuoteId}"/>
                      </apex:column-->
                      <apex:column headerValue="Sales Price">
                          <apex:inputField value="{!row.UnitPrice}"/>
                      </apex:column>
                      <apex:column headerValue="Quantity">
                          <apex:inputField value="{!row.Quantity}"/>
                      </apex:column>
                      <!--apex:column headerValue="Product">
                          <apex:inputField value="{!row.Product2Id}"/>
                      </apex:column-->
                  </apex:pageBlockTable>
              <apex:commandButton action="{!CreateQuoteLineItem}" value="Add Row" immediate="true" reRender="pgt"/>
              
               </apex:pageBlockSection>
               <!--/apex:repeat-->
           </apex:repeat>
           <apex:pageBlockButtons >           
                  <apex:commandButton action="{!QuoteLineItemPage}" value="Save"/>
           </apex:pageBlockButtons>
        </apex:pageBlock>
  </apex:form>
</apex:page>
Users are getting the message below. How can I fix this issue? 

Web service callout failed: WebService returned a SOAP Fault: INSUFFICIENT_ACCESS: use of the Metadata API
requires a user with the ModifyAllData permission faultcode=sf:INSUFFICIENT_ACCESS faultactor=
Error is in expression '{!insertSTC}' in component <apex:commandButton> in page servicetaskscreate:
Class.MetadataService.MetadataPort.readMetadata: line 69, column 1
Class.ServiceTasksCreateController.PicklistField: line 290, column 1
Class.ServiceTasksCreateController.insertSTC: line 226, column 1
An unexpected error has occurred. Your development organization has been notified.
After I successfully uploaded Opportunity objects and their OpportunityLineItem objects, I failed to upload OpportunityLineItemSchedule objects. I got this error "insufficient access rights on cross-reference id
" I'm not sure why this happened, I am sure I have enough access rights to create new opportunities and add products on line in the salesforce.com.  Does anyone have any idea about why this happened?
Users are getting the message below. How can I fix this issue? 

Web service callout failed: WebService returned a SOAP Fault: INSUFFICIENT_ACCESS: use of the Metadata API
requires a user with the ModifyAllData permission faultcode=sf:INSUFFICIENT_ACCESS faultactor=
Error is in expression '{!insertSTC}' in component <apex:commandButton> in page servicetaskscreate:
Class.MetadataService.MetadataPort.readMetadata: line 69, column 1
Class.ServiceTasksCreateController.PicklistField: line 290, column 1
Class.ServiceTasksCreateController.insertSTC: line 226, column 1
An unexpected error has occurred. Your development organization has been notified.

Hi ,

 

     I am confused between synchronous and asynchronous can any one explain me from the scratch what are they actually , and when we use the @future annotation . Please Help me  !!!

 

 

Help is highly appreciated.

 

Thanks in Advance. 

  • June 22, 2013
  • Like
  • 2