• mramaprasad.ax1826
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 22
    Replies
I need to add a date field on to the visualforce page (similar to the date fields we have in opportunity page). 
<apex:page standardController="OpportunityLineItem" extensions="overrideCon" sidebar="true" showHeader="true">

<apex:form id="oppProductForm">

<apex:pageBlock >
    
             
           <div class="pbBody">
                <div class="pbSubheader brandTertiaryBgr first tertiaryPalette" id="head_1_ep">
                    <span class="pbSubExtra"><span class="requiredLegend brandTertiaryFgr"><span class="requiredExampleOuter"><span class="requiredExample">&nbsp;</span></span>
                    <span class="requiredMark">*</span><span class="requiredText"> = Required Information</span></span></span><h3>Product Information<span class="titleSeparatingColon">:</span></h3></div><div class="pbSubsection">
                </div>
                <table class="detailList" border="0" cellpadding="0" cellspacing="0">
                    <tbody>
                    <tr>
                        <td class="labelCol">Opportunity&nbsp;&nbsp;</td><td class="dataCol col02">{!opp.name}</td>
                        <td class="dataCol"><span class="dateInput dateOnlyInput"><input id="ServiceDate" name="ServiceDate" onfocus="DatePicker.pickDate(false, 'ServiceDate', false);" size="12" tabindex="6" type="text" data-uidsfdc="26"/><span class="dateFormat">[&nbsp;<a href="javascript:DatePicker.insertDate('', 'ServiceDate', true);" tabindex="6"></a>&nbsp;]</span></span></td>
                        
                    </tr>
                    <tr><td class="labelCol">Opportunity id &nbsp;&nbsp;</td><td class="dataCol col02">{!opp.Id}</td></tr>
                    <tr>    <td class="labelCol">Product&nbsp;&nbsp;</td><td class="dataCol col02">{!pro.name}</td></tr>
                    <tr>   <td class="labelCol">Quantity&nbsp;&nbsp;</td><td class="dataCol col02"><apex:inputField value="{!OpportunityLineItem.Quantity}"/></td></tr>
                    </tbody>
                </table>
            </div>
</apex:pageBlock>
</apex:form>
</apex:page>

I need simialr functionality as in the opportunity form (current date display and pop of the calender on the date field focus).

Please help.
 
I want to overwrite view button of the opportunity products so I can have specific fields based on the product type.

Here is the visual page code:
<apex:page standardController="OpportunityLineItem" extensions="overrideCon" sidebar="true" showHeader="true">
<apex:form >
<input value=" Save " class="btn" title="Save" name="save" type="submit"/>
<input value="Cancel" class="btn" title="Cancel" name="cancel" type="submit"/>
<apex:pageBlock id="xxxpb1">

Opportunity:&nbsp;&nbsp;{!opp.name}<br></br>
Product:&nbsp;&nbsp;{!pro.name}
Quantity: <apex:inputField value="{!OpportunityLineItem.Quantity}"/>
<apex:pageBlockSection id="xxxpbs2" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BmMdAAK'}">
       product 1 fields
        </apex:pageBlockSection>
    
    <apex:pageBlockSection id="xxxpbs3" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BmMTAA0'}">
        product 2 fields
    </apex:pageBlockSection>
    <apex:pageBlockSection id="xxxpbs4" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BX9SAAW'}">
        product 3 fields
    </apex:pageBlockSection>   
</apex:pageBlock>
</apex:form>  
</apex:page>

Here is the apex code:

public class overrideCon {
private final ID oliId;
    public overrideCon (ApexPages.StandardController stdController) {
        this.oliId = (String)stdController.getId();
    }
    
    Opportunity opp;
    OpportunityLineItem oli;
    Product2 pro;

    public Product2 getPro(){
        if (pro == null) {
            pro = [select Id, name from Product2 where id = :getOli().Product2Id];
        }
    return pro;
    }
    public Opportunity getOpp(){
         if(opp == null){
              opp = [select Id, name, amount, Pricebook2.Name from Opportunity where id = :getOli().Opportunityid];
         }
         return opp;
     } 
     
     public OpportunityLineItem getOli() {
         if(oli == null){
             oli = [select Id, Product2Id, OpportunityID from OpportunityLineItem where ID = :oliID];
         }
         return oli;
     }   
     
     public PageReference save() {
        update oli;
        return null;
    }
    
    public PageReference cancel() {
    return null;
    }

   }


How do I get the save and cancel button to work so changes are saved.
I have added 3 products to an opportunity.When I try to edit the product (opportunity product detail), I need to show differnt fields based on the the the products I am editing. Since I can not create record types for opportunity product I want to write a visualforce page.

Can I achive this by creating a custom class and a visualforce page?
 
Hi,
I am using REST API call to get SF account details. I am able to get OAuth token, but when I use this token to get Account details it gives below rror.

[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]



Here  is the flow

Request:https://ap1.salesforce.com/services/oauth2/token?grant_type=authorization_code&code=aPrxqJ8A8kLOza8Stjpv6sovqPjwgt9wJxzcIaPRsCnGPyxvpLJSOUhmEHkQ7qCNO84np7gXZQ%3D%3D&client_id=3MVG9ZL0ppGP5UrBx8LU.vAPd80ozIo4JMB66N3r1IPzsiMMPzIYm3pklapNDhi24wcd3Ik8JtlQZqr_opatH&client_secret=5390506801126798324&redirect_uri=https://local/user/connector/generic/redirectoauth


Response:
{"id":"https://login.salesforce.com/id/00D28000000KMl1EAG/00528000000MwpQAAS","issued_at":"1428631322872","scope":"id full custom_permissions api web openid visualforce refresh_token chatter_api","instance_url":"https://ap2.salesforce.com","token_type":"Bearer","refresh_token":"5Aep861TSESvWeug_wBae_.NiEYtLVbgA9FW1UDMAq7zqGYpEeyCgRS1jLbqFuSuC2vJd5RyDOmpU.pSPn.Q1zV","id_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjE5NCJ9.eyJleHAiOjE0Mjg2MzE0NDIsInN1YiI6Imh0dHBzOi8vbG9naW4uc2FsZXNmb3JjZS5jb20vaWQvMDBEMjgwMDAwMDBLTWwxRUFHLzAwNTI4MDAwMDAwTXdwUUFBUyIsImF0X2hhc2giOiJlbF9iOXBzSlJCMVFOMGI5cXJib0V3IiwiYXVkIjoiM01WRzlaTDBwcEdQNVVyQng4TFUudkFQZDgwb3pJbzRKTUI2Nk4zcjFJUHpzaU1NUHpJWW0zcHRsYXBORGhpMjR3Y2QzSWs4SnRsUVpxcl9vcGF0SCIsImlzcyI6Imh0dHBzOi8vbG9naW4uc2FsZXNmb3JjZS5jb20iLCJpYXQiOjE0Mjg2MzEzMjJ9.XXfxxvNwQgWrSP-eFoUhFbzDfqxsASntM1slTjhQXN_vgHAp-Wv0rJYBWg6QXcIWwQEsvfCAvGi9JkbRIZ5UYqLPSrnhxsje4StPfvwwHMBMarimqeKKWt24Xb6Hri0DMdp6FjN9y9RneJpVcZeLHbkFnOIUf11cgMk1d3kI9KrgmkoDn8TI1yfPU0NLbJtafnYw2S9cdHrcju31i-9eLjy-yeMrJtinS5TqUdWcalEL1uqZq_KGEnsWkmN8sjEaSgtCio33ZZwDL6IKTgdHeDZedEZfRqhUoyBni14qYdpRX9ANSd1B61HtCVLiAeetc156KB4KYr-oR0Byg7oqAswhU41OQ9RmNp5VDQVVKspgwImauJzhpLs59W64SH5dP
h4xn5SF7fCGK534idYP_HQOey2KxBNrS5ATOATbNHsDt0maztiPK0K8rNjjnARya8QCqPJoumeJddchsmYhMIWPrxtwzNdpPXMuSz3hY3xIALFf0cDW_OwBPWT4P3_KZqfE7w0lPihzwhTwHy4tSu_kq4t4ikMu-xc6TNkZoy4HJP_qNZ7f7CCENHvUHjF_vgjSqNcPVJnpp-g3ImN6eBbstsndoktkdxpSC8N34WyWwKxiC5S5NVtgJBbLI2J9Q8xdBvcArvvoANt6_nhjsDf6417kRstohZio1aOoSW8","signature":"3yrSoEaIoCEtGXZpMHaLnV8B6z/njamvHSPTOHUB9ME=","access_token":"00D28000000KMl1!ARAAQPLIuaRCKyXQPB1LDjuiF4Bg1QAVfzXNFpq7C4zYRVurh3JxqYpcu5IIf98P1XOB7oEwLkbSJwdq4Mc0pxkmaQCbjbgd"}

token 00D28000000KMl1!ARAAQPLIuaRCKyXQPB1LDjuiF4Bg1QAVfzXNFpq7C4zYRVurh3JxqYpcu5IIf98P1XOB7oEwLkbSJwdq4Mc0pxkmaQCbjbgd
Request:https://ap1.salesforce.com/services/data/v31.0/query?q=SELECT+Name+From+User+WHERE+Id='00528000000MwpQAAS'
Authorization:Bearer 00D28000000KMl1!ARAAQPLIuaRCKyXQPB1LDjuiF4Bg1QAVfzXNFpq7C4zYRVurh3JxqYpcu5IIf98P1XOB7oEwLkbSJwdq4Mc0pxkmaQCbjbgd

Error while sending Salesforce request {}HTTP_401 : [{"message":"Session expired
 or invalid","errorCode":"INVALID_SESSION_ID"}]


Thanks,
Veera.
I need to add a date field on to the visualforce page (similar to the date fields we have in opportunity page). 
<apex:page standardController="OpportunityLineItem" extensions="overrideCon" sidebar="true" showHeader="true">

<apex:form id="oppProductForm">

<apex:pageBlock >
    
             
           <div class="pbBody">
                <div class="pbSubheader brandTertiaryBgr first tertiaryPalette" id="head_1_ep">
                    <span class="pbSubExtra"><span class="requiredLegend brandTertiaryFgr"><span class="requiredExampleOuter"><span class="requiredExample">&nbsp;</span></span>
                    <span class="requiredMark">*</span><span class="requiredText"> = Required Information</span></span></span><h3>Product Information<span class="titleSeparatingColon">:</span></h3></div><div class="pbSubsection">
                </div>
                <table class="detailList" border="0" cellpadding="0" cellspacing="0">
                    <tbody>
                    <tr>
                        <td class="labelCol">Opportunity&nbsp;&nbsp;</td><td class="dataCol col02">{!opp.name}</td>
                        <td class="dataCol"><span class="dateInput dateOnlyInput"><input id="ServiceDate" name="ServiceDate" onfocus="DatePicker.pickDate(false, 'ServiceDate', false);" size="12" tabindex="6" type="text" data-uidsfdc="26"/><span class="dateFormat">[&nbsp;<a href="javascript:DatePicker.insertDate('', 'ServiceDate', true);" tabindex="6"></a>&nbsp;]</span></span></td>
                        
                    </tr>
                    <tr><td class="labelCol">Opportunity id &nbsp;&nbsp;</td><td class="dataCol col02">{!opp.Id}</td></tr>
                    <tr>    <td class="labelCol">Product&nbsp;&nbsp;</td><td class="dataCol col02">{!pro.name}</td></tr>
                    <tr>   <td class="labelCol">Quantity&nbsp;&nbsp;</td><td class="dataCol col02"><apex:inputField value="{!OpportunityLineItem.Quantity}"/></td></tr>
                    </tbody>
                </table>
            </div>
</apex:pageBlock>
</apex:form>
</apex:page>

I need simialr functionality as in the opportunity form (current date display and pop of the calender on the date field focus).

Please help.
 
I want to overwrite view button of the opportunity products so I can have specific fields based on the product type.

Here is the visual page code:
<apex:page standardController="OpportunityLineItem" extensions="overrideCon" sidebar="true" showHeader="true">
<apex:form >
<input value=" Save " class="btn" title="Save" name="save" type="submit"/>
<input value="Cancel" class="btn" title="Cancel" name="cancel" type="submit"/>
<apex:pageBlock id="xxxpb1">

Opportunity:&nbsp;&nbsp;{!opp.name}<br></br>
Product:&nbsp;&nbsp;{!pro.name}
Quantity: <apex:inputField value="{!OpportunityLineItem.Quantity}"/>
<apex:pageBlockSection id="xxxpbs2" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BmMdAAK'}">
       product 1 fields
        </apex:pageBlockSection>
    
    <apex:pageBlockSection id="xxxpbs3" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BmMTAA0'}">
        product 2 fields
    </apex:pageBlockSection>
    <apex:pageBlockSection id="xxxpbs4" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BX9SAAW'}">
        product 3 fields
    </apex:pageBlockSection>   
</apex:pageBlock>
</apex:form>  
</apex:page>

Here is the apex code:

public class overrideCon {
private final ID oliId;
    public overrideCon (ApexPages.StandardController stdController) {
        this.oliId = (String)stdController.getId();
    }
    
    Opportunity opp;
    OpportunityLineItem oli;
    Product2 pro;

    public Product2 getPro(){
        if (pro == null) {
            pro = [select Id, name from Product2 where id = :getOli().Product2Id];
        }
    return pro;
    }
    public Opportunity getOpp(){
         if(opp == null){
              opp = [select Id, name, amount, Pricebook2.Name from Opportunity where id = :getOli().Opportunityid];
         }
         return opp;
     } 
     
     public OpportunityLineItem getOli() {
         if(oli == null){
             oli = [select Id, Product2Id, OpportunityID from OpportunityLineItem where ID = :oliID];
         }
         return oli;
     }   
     
     public PageReference save() {
        update oli;
        return null;
    }
    
    public PageReference cancel() {
    return null;
    }

   }


How do I get the save and cancel button to work so changes are saved.
I have added 3 products to an opportunity.When I try to edit the product (opportunity product detail), I need to show differnt fields based on the the the products I am editing. Since I can not create record types for opportunity product I want to write a visualforce page.

Can I achive this by creating a custom class and a visualforce page?