• Naveed Anwar
  • NEWBIE
  • 25 Points
  • Member since 2010

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

Hello,

 

I am running the following code in c# .net and getting the exception : STANDARD_PRICE_NOT_DEFINED

when trying to insert the pricebookentry record.

Can anyone tell, where to set the "STANDARD_PRICE". Thanks!

 

private string createPriceBookEntry(string priceBookId, string itemCode, string description, double unitPrice)

{

                string product2Id = createProduct2(itemCode, description);

                PricebookEntry pricebookEntry = new PricebookEntry();
                pricebookEntry.Pricebook2Id = priceBookId;
                
                pricebookEntry.UnitPrice = unitPrice;
                pricebookEntry.UnitPriceSpecified = true;
                pricebookEntry.IsActive = true;
                pricebookEntry.IsActiveSpecified = true;
                pricebookEntry.UseStandardPrice = false;
                pricebookEntry.UseStandardPriceSpecified = true;
                pricebookEntry.Product2Id = product2Id;
               
                SaveResult[] result = InsertToFF((sObject)pricebookEntry);
}

 

EDIT:

 

private SaveResult[] InsertToFF(sObject sfObj)
{
            SaveResult[] result = null;


            result =
                 ffInt.SFBinding.create(new sObject[] { sfObj });

            return result;
}

 

It worked fine with "Standard Price Book" but it generated error while creating opportunity line item:

Error was like: "The currency codes in Opportunity and Opportunity Line Item are not same"

 

I want to make it work for my own custom price book that has no standard Price field.

 

Thanks!

Hi,

 

I have modified the code from the site : http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/comment-page-1/#comment-930


I have one issue that i cannot able to solve. It is not rerendering. When i remove the following piece of code from visualforce page, it works fine


-----------------------------------------------------------------------------
 <apex:pageBlockSection columns="1">



<apex:pageblockSectionItem >


<apex:outputText value="Account" />
<apex:inputField value="{!account.ParentID}" id="LookupAccount" required="true" />

</apex:pageblockSectionItem>

</apex:pageBlockSection>
----------------------------------------------------------------------------

Full Visual force code:

<apex:page controller="PagingController">
<apex:form >
<apex:pageBlock>

<apex:pageBlockSection columns="1">

<apex:pageblockSectionItem >

<apex:outputText value="Account" />
<apex:inputField value="{!account.ParentID}" id="LookupAccount" required="true" />

</apex:pageblockSectionItem>

</apex:pageBlockSection>

<apex:pageBlockButtons location="top">
</apex:pageBlockButtons>
<apex:pageMessages />

<apex:pageBlockSection title="Account Results - Page #{!pageNumber}" columns="1" id="pageblock">

<apex:pageBlockTable value="{!accounts}" var="c">
<apex:column value="{!c.Name}" headerValue="Name"/>
</apex:pageBlockTable>
</apex:pageBlockSection>

</apex:pageBlock>

<apex:panelGrid columns="4">
<apex:commandLink action="{!first}" rerender="pageblock">First</apex:commandlink>
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}" rerender="pageblock">Previous</apex:commandlink>
<apex:commandLink action="{!next}" rendered="{!hasNext}" rerender="pageblock">Next</apex:commandlink>
<apex:commandLink action="{!last}" rerender="pageblock">Last</apex:commandlink>
</apex:panelGrid>

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

Controller Code:

public with sharing class PagingController {

public Account getAccount()
{
return [Select a.ParentID From Account a Limit 1];
}

// instantiate the StandardSetController from a query locator
public ApexPages.StandardSetController con {
get {
if(con == null) {
con = new ApexPages.StandardSetController(Database.getQueryLocator([Select Name FROM Account Order By Name limit 100]));
// sets the number of records in each page set
con.setPageSize(5);
}
return con;
}
set;
}

// returns a list of wrapper objects for the sObjects in the current page set
public List<Account> getAccounts() {
return (List<Account>)con.getRecords();
}

// indicates whether there are more records after the current page set.
public Boolean hasNext {
get {
return con.getHasNext();
}
set;
}

// indicates whether there are more records before the current page set.
public Boolean hasPrevious {
get {
return con.getHasPrevious();
}
set;
}

// returns the page number of the current page set
public Integer pageNumber {
get {
return con.getPageNumber();
}
set;
}

// returns the first page of records
public void first() {
con.first();
}

// returns the last page of records
public void last() {
con.last();
}

// returns the previous page of records
public void previous() {
con.previous();
}

// returns the next page of records
public void next() {
con.next();
}


}


Can anyone help me?

 Hi,

 

I am trying to build a query for multilevel relations.

 

I have 3 Objects that are involved in the query.

Item, PackageItem and Package.

 

Item linked to PackageItem through ItemCode.

PackageItem linked to Package through PackageCode.

 

What i want is to extract "PackageCode". So far i tried the following query.

 

Select Name, (Select Name From PackageItems__r) From Item__c Where ProgramID__c != null

 

I cannot find a way to include Package object in the query.

 

Please help

Thanks!

 

Hey there,

 

i am using C# and enterprise.wsdl and my problem is that i want to upsert some record in my custom objects. i have two custom objects Level__c and Consultant__c and there is a lookup field in Consultant__c against Level__c. i do not have Salesforce Id but i have externalId of level

 

two fields are visible in Level__c(Type: string), Level__r(Type: Level__c). which fields needs to be populate

 

do i need to query level__c salesforce id on the basis of external System Id. or is there any other way through which i can achieve this functionality as well ...

 

Thanks!

Naveed Anwar  

Hi,

 

I have modified the code from the site : http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/comment-page-1/#comment-930


I have one issue that i cannot able to solve. It is not rerendering. When i remove the following piece of code from visualforce page, it works fine


-----------------------------------------------------------------------------
 <apex:pageBlockSection columns="1">



<apex:pageblockSectionItem >


<apex:outputText value="Account" />
<apex:inputField value="{!account.ParentID}" id="LookupAccount" required="true" />

</apex:pageblockSectionItem>

</apex:pageBlockSection>
----------------------------------------------------------------------------

Full Visual force code:

<apex:page controller="PagingController">
<apex:form >
<apex:pageBlock>

<apex:pageBlockSection columns="1">

<apex:pageblockSectionItem >

<apex:outputText value="Account" />
<apex:inputField value="{!account.ParentID}" id="LookupAccount" required="true" />

</apex:pageblockSectionItem>

</apex:pageBlockSection>

<apex:pageBlockButtons location="top">
</apex:pageBlockButtons>
<apex:pageMessages />

<apex:pageBlockSection title="Account Results - Page #{!pageNumber}" columns="1" id="pageblock">

<apex:pageBlockTable value="{!accounts}" var="c">
<apex:column value="{!c.Name}" headerValue="Name"/>
</apex:pageBlockTable>
</apex:pageBlockSection>

</apex:pageBlock>

<apex:panelGrid columns="4">
<apex:commandLink action="{!first}" rerender="pageblock">First</apex:commandlink>
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}" rerender="pageblock">Previous</apex:commandlink>
<apex:commandLink action="{!next}" rendered="{!hasNext}" rerender="pageblock">Next</apex:commandlink>
<apex:commandLink action="{!last}" rerender="pageblock">Last</apex:commandlink>
</apex:panelGrid>

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

Controller Code:

public with sharing class PagingController {

public Account getAccount()
{
return [Select a.ParentID From Account a Limit 1];
}

// instantiate the StandardSetController from a query locator
public ApexPages.StandardSetController con {
get {
if(con == null) {
con = new ApexPages.StandardSetController(Database.getQueryLocator([Select Name FROM Account Order By Name limit 100]));
// sets the number of records in each page set
con.setPageSize(5);
}
return con;
}
set;
}

// returns a list of wrapper objects for the sObjects in the current page set
public List<Account> getAccounts() {
return (List<Account>)con.getRecords();
}

// indicates whether there are more records after the current page set.
public Boolean hasNext {
get {
return con.getHasNext();
}
set;
}

// indicates whether there are more records before the current page set.
public Boolean hasPrevious {
get {
return con.getHasPrevious();
}
set;
}

// returns the page number of the current page set
public Integer pageNumber {
get {
return con.getPageNumber();
}
set;
}

// returns the first page of records
public void first() {
con.first();
}

// returns the last page of records
public void last() {
con.last();
}

// returns the previous page of records
public void previous() {
con.previous();
}

// returns the next page of records
public void next() {
con.next();
}


}


Can anyone help me?

 Hi,

 

I am trying to build a query for multilevel relations.

 

I have 3 Objects that are involved in the query.

Item, PackageItem and Package.

 

Item linked to PackageItem through ItemCode.

PackageItem linked to Package through PackageCode.

 

What i want is to extract "PackageCode". So far i tried the following query.

 

Select Name, (Select Name From PackageItems__r) From Item__c Where ProgramID__c != null

 

I cannot find a way to include Package object in the query.

 

Please help

Thanks!

 

Hey there,

 

i am using C# and enterprise.wsdl and my problem is that i want to upsert some record in my custom objects. i have two custom objects Level__c and Consultant__c and there is a lookup field in Consultant__c against Level__c. i do not have Salesforce Id but i have externalId of level

 

two fields are visible in Level__c(Type: string), Level__r(Type: Level__c). which fields needs to be populate

 

do i need to query level__c salesforce id on the basis of external System Id. or is there any other way through which i can achieve this functionality as well ...

 

Thanks!

Naveed Anwar  

Hi,

 

i have list button in CASE object which Open visualforce page and have enabled Display checkboxes for muli-record selection.

 

I want to make some javascript for this button or some code for page which:

 

1. show alert and block all controls on page with standard CASE Button controller so user must click BACK in navigation

 

OR

 

2. Show alert windows when user click on list view button and there is no selection and after this alert will be no redirect to VF page

 

 

How Can I do it?

Here is the visualforce code:

 

<apex:detail subject="{!$User.contactId}" relatedList="true"/>

 

Trying to let the Portal user edit their own contact record including custom fields.

 

 

The profile of the Portal user has Read and Edit checked for Contact records also.

Hi,

 

I'm new to Salesforce. I'm trying to insert data from my website code into Salesforce.

 

Can I get C sharp sample code to insert into Custom objects?

 

Thanks in advance

  • December 09, 2009
  • Like
  • 0

Hi,


I am looking for a way to update a large number of opportunity records at once from a list view. I specifically need to update the following fields:

 

Native SF Fields:

amount, stage

 

Custom Fields:

accounting stage, payment received, transaction number

 

We need this funcitonality because a number of opportunities are included on each invoice, so we need to update them all once we have sent the invoice, received payment etc. The goal is to select the items from a list view and then hit an 'Update' button that will prompt us to update the fields above with the new values.

 

I am experienced with Salesforce, but my code writing skills are minimal to subpar at best. I am thankful for any help or suggestions you may have.

DF