• PranavLAX
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies

Hi,

 

Following is my VF page where for some reason the re-rendering conditions are not working.

 

Basically want to re-render when Type of Upgrade is Software (Entitlements) or Hardware (Appliance)

 

Can you please tell me what I maybe doing wrong here?

 

 

 

<apex:page standardController="Opportunity" extensions="RMCWizard" tabStyle="Opportunity" sidebar="false" wizard="true" >

<apex:sectionHeader title="Opportunity Upgrade Wizard" subtitle="Step 1 of 7"/>
<apex:form id="theForm" >

<apex:pageBlock id="theSearchBlock" title="Product Information" mode="edit" >
<apex:pageBlockButtons location="both" >
<apex:commandButton action="{!saveRMC}" value="Save and Update RMC" />
<apex:commandButton aaction="{!saveSF}" value="Save and Create Upgrade Opportunity in SFDC" >
</apex:commandButton>

</apex:pageBlockButtons>

<apex:pageBlockSection id="Type" columns="1" collapsible="false" >
<apex:pageBlockSectionItem >
<apex:outputLabel >What is the upgrade Type?</apex:outputLabel>
<apex:inputField value="{!Opportunity.Type_of_Upgrade__c}" >
<apex:actionSupport event="onchange" status="StatusChange" rerender="theForm" />
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>

<apex:pageBlockSection columns="1" id="SW1" collapsible="false" >
<apex:pageBlockSectionItem rendered="!{Opportunity.Type_of_Upgrade__c = 'Software (Entitlements)'}" >
<apex:outputLabel >Select the Software Product</apex:outputLabel>
<apex:inputField value="{!Opportunity.Software_Product__c}" >
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection columns="1" id="Uprice" collapsible="false" >
<apex:pageBlockSectionItem rendered="{!Opportunity.Type_of_Upgrade__c='Software (Entitlements)'}" >
<apex:outputLabel >Select the Unit Price for the Product </apex:outputLabel>
<apex:inputField value="{!Opportunity.Software_Unit_Price__c}" >
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection columns="1" id="HW1" collapsible="false" >
<apex:pageBlockSectionItem rendered="{!Opportunity.Type_of_Upgrade__c='Hardware (Appliance)'}" >
<apex:outputLabel >Select the Hardware Product</apex:outputLabel>
<apex:inputField value="{!Opportunity.Hardware_Product__c}" required="true">
<apex:actionSupport event="onchange" status="StatusChange" rerender="" >

</apex:actionSupport>
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection id="DC" columns="1" collapsible="false" >
<apex:pageBlockSectionItem >
<apex:outputLabel >Select the Applicable Data Center</apex:outputLabel>
<apex:inputField value="{!Opportunity.Data_Center__c}" required="true">
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection id="Partner" columns="1" collapsible="false" >
<apex:pageBlockSectionItem >
<apex:outputLabel >Confirm the Partner</apex:outputLabel>
<apex:inputField value="{!Opportunity.AccountID}" required="true">
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection id="EC" columns="1" collapsible="false" >
<apex:pageBlockSectionItem >
<apex:outputLabel >Confirm the End Customer</apex:outputLabel>
<apex:inputField value="{!Opportunity.End_Customer__c}" required="true">
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>

</apex:pageBlock>


</apex:form>
</apex:page>

Hi,

 

I am tying to insert an OLI to the Opportunity here via the apex controller class.

 

The following code occurs when the save button is clicked.

 

When I am trying to insert the PriceBookEntry, I am getting the message of Duplicate Value. Please help.

 

 

Opportunity UpgradedOpportunity = new Opportunity(Name='Upgrade From' +CurrOpp.Name,StageName=CurrOpp.StageName,CloseDate=CurrOpp.CloseDate,Upgraded_From__c = opp.Id);
insert UpgradedOpportunity ;

Pricebook2  standardPb = [select id, name, isActive from Pricebook2 where IsStandard = true limit 1];
Pricebook2  ResellerPb = [select id, name, isActive from Pricebook2 where IsStandard = false and Name ='Reseller Price Book' limit 1];

PriceBookEntry PBESW = new PriceBookEntry(Pricebook2ID=StandardPb.Id,Product2ID=opp.Software_Product__c,UseStandardPrice=FALSE, UnitPrice= 2109.0);
System.debug('***************Product2ID'+opp.Software_Product__c);

insert PBESW ;

Hello,

Can anyone please provide some guidance in how to go about writing test code coverage for Webservices API Calls to a 3rd party application.

Following is the code, that I am trying to get code coverage for:

 String datumapp = '{'
      + '"serial_number":"'+SerialNumber + '",'
      + '"model":"A20-R-500",'
      + '"reseller":"'+ SFDCResellerID +'",'
      + '"client":"' + SFDCClientID +'",'
      + '"package":"'+ PackageType +'",'
      + '"offsite":"'+ Offsite +'",'
      + '"data_center":"'+ DataCenter +'",'
      + '"status":"active"'
      + '}';
      
             
      Http httpProtocolInsertAppliance = new Http();       // Create HTTP request to send.
      HttpRequest requestapp = new HttpRequest(); // Set the endpoint URL.
      String endpointapp = 'https://rmc01.asdsdt.net/sfapi/appliance/';
      requestapp.setEndPoint(endpointapp);
      requestapp.setBody(datumapp);
      requestapp.setMethod('POST');
      requestapp.setHeader('X-API-KEY','abczyx');
      requestapp.setHeader('Content-length', String.valueOf(datumapp.length()));

      
      try
      {
      
      HttpResponse responseapp = httpProtocolInsertAppliance.send(requestapp);
      System.debug(responseapp.getBody()+'APPLIANCE INSERTION CHECK 1');
      System.debug(responseapp.getHeader('Location')+'APPLIANCE INSERTION CHECK 1');
     
      
      if(String.valueof(responseapp.getStatus())=='400')
      {
      
      throw new IntegrationException('Already exists');
      }

    Submitted

Hi,

 

We are looking to  create a record (Asset) as an appliance in an external system from Salesforce.

 

This would get triggered when a button is clicked upon on the Asset object

 

Can you please guide to some code samples that use REST APIs to connect to external systems and insert records in it and in return fetch a value which is created in the external system.

 

 

Requests:


Action |HTTP Method| URL|
Create | POST | http://xyz.com/sfapi/appliance/
Read GET http://rxyz.com/sfapi/appliance/:id
Update PUT http://xyz.com/sfapi/appliance/:id
Delete DELETE http://rmc.com/sfapi/appliance/:id

 

 

Hi,

 

I am tying to insert an OLI to the Opportunity here via the apex controller class.

 

The following code occurs when the save button is clicked.

 

When I am trying to insert the PriceBookEntry, I am getting the message of Duplicate Value. Please help.

 

 

Opportunity UpgradedOpportunity = new Opportunity(Name='Upgrade From' +CurrOpp.Name,StageName=CurrOpp.StageName,CloseDate=CurrOpp.CloseDate,Upgraded_From__c = opp.Id);
insert UpgradedOpportunity ;

Pricebook2  standardPb = [select id, name, isActive from Pricebook2 where IsStandard = true limit 1];
Pricebook2  ResellerPb = [select id, name, isActive from Pricebook2 where IsStandard = false and Name ='Reseller Price Book' limit 1];

PriceBookEntry PBESW = new PriceBookEntry(Pricebook2ID=StandardPb.Id,Product2ID=opp.Software_Product__c,UseStandardPrice=FALSE, UnitPrice= 2109.0);
System.debug('***************Product2ID'+opp.Software_Product__c);

insert PBESW ;

Hi,

 

We are looking to  create a record (Asset) as an appliance in an external system from Salesforce.

 

This would get triggered when a button is clicked upon on the Asset object

 

Can you please guide to some code samples that use REST APIs to connect to external systems and insert records in it and in return fetch a value which is created in the external system.

 

 

Requests:


Action |HTTP Method| URL|
Create | POST | http://xyz.com/sfapi/appliance/
Read GET http://rxyz.com/sfapi/appliance/:id
Update PUT http://xyz.com/sfapi/appliance/:id
Delete DELETE http://rmc.com/sfapi/appliance/:id

 

 

Hi,

 

I overrided case view button with a visualforce page. When I created  a service cloud console app, and opened a case record, it displays External Page. Is there a way to rename the page with the case number.

 

Thanks in advance.

 

  • June 10, 2011
  • Like
  • 0

I am trying to unit test an Apex class that I've written but I am having a lot of trouble with the "standard price"

 

Below is the code and the error I am recieving: 

 

Pricebook2 standardPb = [SELECT Id, Name from Pricebook2 WHERE isStandard=true];

 PricebookEntry standardpbEntry = new PricebookEntry(unitPrice=0, useStandardPrice=true, Product2Id=testProduct.Id,Pricebook2Id=standardPb.Id );

 

 

 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: UnitPrice (unit price not equal to standard price): [UnitPrice]

 

I have no idea how the standardPrice got set, or where to find it so I can use the correct unit price.

 

Any help would be very much appreciated

 

 

  • May 14, 2009
  • Like
  • 0