• D srinivas 8734
  • NEWBIE
  • 35 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies

Hi,

I am creating a validation rule to restrict user from entering amount less than 10000$ when industry type is Corporate. I am facing an error.

Any help will be appreciated.

Thanks

John 

i have data in custom setting so i am displaying custom setting data on visualforce page with edit button if we click edit button then we can change data & save the record ,after saving the record it has to redirect to edit page .
here i am facing issue with redirect to edit page 
my code is 
public class configpage {
    public   string  clientid {get;set;}
    public   string  clientSecret {get;set;}   
    public   string scope{get;set;}
    public   string  realmid {get;set;}
    public   string  redirecturi {get;set;}
    public  final Quickbook__c acct;
    
    public   boolean firstPanel{get;set;}
    public   boolean secondPanel{get;set;}
    public   boolean thirdPanel{get;set;}
    //public PageReference refresh=ApexPages.currentPage();

    public configpage(){
     //this.acct=(Quickbook__c)controller.getRecord();        
        firstPanel = true;
        secondPanel = true;
        thirdPanel = false;
     Quickbook__c qbcss= Quickbook__c.getorgdefaults();
        //[select ClientId__c,Clientsecret__c,Scope__c,realmid__c,Redirect_URI__c from Quickbook__c]
        
            clientid = qbcss.ClientId__c;
            clientSecret = qbcss.Clientsecret__c;           
            scope=qbcss.Scope__c;
            realmid=qbcss.realmid__c;
            redirecturi=qbcss.Redirect_URI__c; 
            
        
    }
    public  void firstButton()
    {
        firstPanel=true;
        secondPanel= true;
        thirdPanel = false; 
        
       // list<Quickbook__c> confList=[select id,ClientId__c,Clientsecret__c,Scope__c,realmid__c,Redirect_URI__c from Quickbook__c];
       Quickbook__c qbcss= Quickbook__c.getorgdefaults(); 
        clientid = qbcss.ClientId__c;
            clientSecret = qbcss.Clientsecret__c;           
            scope=qbcss.Scope__c;
            realmid=qbcss.realmid__c;
            redirecturi=qbcss.Redirect_URI__c; 
            
    }
    
     public  void secondButton(  )
    {
        firstPanel=false;
        secondPanel=false;
        thirdPanel = true; 
        
        
    }
    
    public void Cancel(){
        firstPanel = true;
        secondPanel = true;
        thirdPanel = false; 
        
    }
     public  void thirdButton()
    {
        firstPanel = true;
        secondPanel = false;
        thirdPanel = false;
        if(firstPanel == true){
            //Quickbook__c qbc=new Quickbook__c();
            Quickbook__c qbc=Quickbook__c.getorgdefaults();
            qbc.Name='ETG';
            qbc.ClientId__c=clientid;
            qbc.Clientsecret__c=clientSecret;
            qbc.Scope__c=scope;
            qbc.realmid__c=realmid;
            qbc.Redirect_URI__c=redirecturi;
            
            update qbc;
                      
        }
        
        else if(firstPanel != true){
        //Quickbook__c qbcs=new Quickbook__c();
            Quickbook__c qbcs=Quickbook__c.getorgdefaults();
                
            
            qbcs.Name='ETG';
            qbcs.ClientId__c=clientid;
            qbcs.Clientsecret__c=clientSecret;
            qbcs.Scope__c=scope;
            qbcs.realmid__c=realmid;
            qbcs.Redirect_URI__c=redirecturi;
            
            update qbcs;
            
             
        }               
            
    }
 
}
visualforce page
<apex:page controller="configpage" tabStyle="account" lightningStylesheets="true" showHeader="false" sidebar="false">
    <style type="text/css">
        .divclass{
        margin-left:350px;
        }
    </style>
    <apex:form style="font-size:15px;" id="all">
        <apex:pageBlock >
            <apex:pageBlockSection columns="1" title=" Configuration page" rendered="{!firstPanel}"  collapsible="false" >   
               
                <apex:outputPanel >
                    <div class="divclass">
                         
                    </div>
                </apex:outputPanel>              
            </apex:pageBlockSection>                   
            <apex:pageBlockSection id="sec"  columns="1" rendered="{!secondPanel}">
                
                <apex:outputText label="Api Key :" value="{!clientid}"/>
                <apex:outputText label="Api Secret :" value="{!clientSecret}"/>                
                <apex:outputText label="scope" value="{!scope}"/>
                <apex:outputText label="id" value="{!realmid}"/>
                <apex:outputText label="redirecturi" value="{!redirecturi}"/> 
                <apex:outputPanel >
                    <div class="divclass">
                        <apex:commandButton value="Edit" action="{!secondButton}"/> 
                      
                    </div>
                </apex:outputPanel>                
            </apex:pageBlockSection> 
  <apex:pageBlockSection columns="1"  id="third" rendered="{!thirdPanel}" >
                <apex:pageMessages ></apex:pageMessages>
                <apex:inputText value="{!clientid}" label="Api Key:" required="true" />
                <apex:inputText value="{!clientSecret}" label="Api Secret:" required="true"/>              
               <apex:inputText value="{!scope}" label="scope " required="true"/>
                <apex:inputText value="{!realmid}" label="realmid:" required="true"/>
                <apex:inputText value="{!redirecturi}" label="redirecturi:" required="true" style="width:600px;"/>
                <apex:outputPanel >
                    <div class="divclass">
                        <apex:commandButton value="Save" action="{!thirdButton}" reRender="all"/> 
                        <apex:commandButton value="Cancel" action="{!Cancel}"/>
                    </div>
                </apex:outputPanel>   
            </apex:pageBlockSection>                
        </apex:pageBlock>
    </apex:form>
</apex:page>
can any one help me ...
while importing products from other system i am able to create pricebookentries for standard pricebook,i need to create pricebookentries for custom pricebooks also ?
here is my code

QB_PriceBook__c pb_custset=QB_PriceBook__c.getOrgdefaults();
          system.debug('pb name====='+pb_custset.global_123__pricebook_Name__c);
         list<pricebook2> QB_pricebooklst=[select id from pricebook2 where Name=:pb_custset.pricebook_Name__c AND isActive=true];
        
        // map of all price book entry
        
        Map<ID,PricebookEntry> priceBkEntryMap= new Map<Id, PricebookEntry>();
        
        for ( PriceBookEntry pbEntry : [select Product2Id, UnitPrice from PriceBookEntry where Product2Id in :prodMap.keySet()]){
            priceBkEntryMap.put(pBEntry.Product2Id, pbEntry);
        }   
        system.debug('pricebookentrymap'+priceBkEntryMap);
        List <PriceBookEntry> pbEntryToUpdate = new List<PriceBookEntry>(); 
        
        for(product2 prd:prolst ){
            // check if pricebookentry already exists
            system.debug('product id:'+prd.id);
            PricebookEntry pbEntry = priceBkEntryMap.get(prd.Id);
            system.debug('Found Pricebook entry:' + pbEntry);
            if (pbEntry != null) {
                System.debug('Updating Pricebook Entry');
                if (pbEntry.UnitPrice != decimal.valueOf(prd.price__c) ){
                    System.debug('Pricebook updating price only:'+  decimal.valueOf(prd.price__c) );
                    pbEntry.UnitPrice= decimal.valueOf(prd.price__c);
                    pbEntryToUpdate.add(pbEntry); 
                }    
            }
            else {
                System.debug('Creating new Pricebook Entry');
                PricebookEntry pbe = new PricebookEntry();
                pbe.Pricebook2Id=QB_pricebooklst[0].id; //pricebook ID
                pbe.Product2Id=prd.id;
                pbe.IsActive=true;
                //pbe.UseStandardPrice=false;
                pbe.UnitPrice=decimal.valueOf(prd.price__c);
                pbEntryToUpdate.add(pbe);
            }

        }
        system.debug('my pricebookentry: '+pbEntryToUpdate);
        if(pbEntryToUpdate.size()>0){
            upsert pbEntryToUpdate;
        }
i created one custom price book that i need to change into standard pricebook how can i do that?can any one help me  

in the standard price book check box we need to deactivate? 
i am importing products from other system into salesforce ,
i have to store pricebook name in custom setting from their i have to query the pricebook & create pricebookentry for each and every imported products ,
can anyone assist me ?
apex class is calling from onclick javascript button its working fine ,but in lightning button is not showing ...

button code here invoicecreation is apex class & senddata, invoicepdf are class methods ,invoicecreation  is api related

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

sforce.apex.execute("invoicecreation","senddata",{odr:"{!Order.Id}"});
sforce.apex.execute("invoicecreation","invoicepdf",{odr:"{!Order.Id}"});


alert("Invoice creation Request submitted");

Hi,

I am creating a validation rule to restrict user from entering amount less than 10000$ when industry type is Corporate. I am facing an error.

Any help will be appreciated.

Thanks

John 

Hi there,

I am trying to override Account New button using lightning:actionOverride.
How do we implement cancel button to return previous page.
Scenario images are as follow.

User-added imageUser-added imageUser-added imageUser-added image
Thank in advance,
Regards,
LinThaw