• maz00
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies

Hi,

When you store assigned products to opportunities (using Product) in OpportunityLineItem where do you store them for Product2?

Thanks
Maz.

  • February 08, 2005
  • Like
  • 0

Hi,

I have many dropdown lists on my aspx pages with the first element being --None-- with a value of "". Every time user selects an item I just do something similar to

Opp.Distributor__c = ddlDistributor__c.SelectedValue;

My questions is how do set it to unselected/not selected?

Opp.Distributor__c = ""  doesn't work?

Thank you
Maz.

  • February 07, 2005
  • Like
  • 0

Hi,

I'm having problems creating and updating products assigned to opportunities. Here is my setup

* I have defined around 10 products and with their defaultprice
* I have created a way to update currently assigned products to opportunities which works fine as long as the product was added to the opportunity using SalesForce.com and not my application. 
* I have created a way to assign new products to individual opportunities.
* My application automatically calculates the UnitPrice for individual account based on certain criteria.

Problem: Everytime I add a new product to my opportunity and I try to update it, it uses the TotalPrice/Quantity to calculate my UnitPrice even though I have the .UnitPrice assignment which messes up everything since I always want to take the Quantity * UnitPrice.  However, when I call my update twice sending the same parameters it then works fine.  Basically updating the record twice with the same parameters (UnitPrice, Quantity)

My code assignment
For Update
sforce.OpportunityLineItem OppLineItem = new sforce.OpportunityLineItem();

OppLineItem.Id = Id;
OppLineItem.Quantity = Quantity;
OppLineItem.QuantitySpecified = true;
OppLineItem.UnitPrice = resellerPrice;
OppLineItem.UnitPriceSpecified =
true;
OppLineItem.udfPSPrice__cSpecified =
true;

sforce.SaveResult[] sr = binding.update(new sforce.sObject[]{OppLineItem});

and for Insert

sforce.OpportunityLineItem OppLineItem = new sforce.OpportunityLineItem();

OppLineItem.OpportunityId = OppId;
OppLineItem.ProductId = ProductId;
OppLineItem.UnitPrice = resellerPrice;
OppLineItem.UnitPriceSpecified = true;
OppLineItem.Quantity = Quantity;
OppLineItem.QuantitySpecified =
true;
sforce.sObject[] records = new sforce.sObject[] {OppLineItem};
sforce.SaveResult[] saveResults = binding.create(records);

Can someone please help me get this working? Why does it take the Total and divides by Quantity the first after an insert?

Thank you
Maziar A.


 

  • February 07, 2005
  • Like
  • 0

Hi,

Is it possible to define a new custom field as a lookup field. So that the contents of the field is dependent on another field? I want to create add a dropdown list and define as a lookup field with it's content being populated from all Account names.

Thank you
Maz.

 

  • January 18, 2005
  • Like
  • 0

Hi,

Does the API support nested select?

Such as,

qr = binding.query("SELECT Opportunity.Id, Opportunity.AccountId, Opportunity.Name, Opportunity.Description, Opportunity.OwnerId, Opportunity.StageName from Opportunity, Account WHERE Opportunity.AccountId=Account.Id");

Thank you
Maz.

  • January 14, 2005
  • Like
  • 0

Hi everyone,

I just used the describeSObject to grab the available values for my picklists.  However, I don't want to query the entire list of fields just to get one.  Is it possible to just query 1 field and get the available fields just for that? Here is my code which is similar to the API documentation? BTW, I know I can use drs.fields[number in here] however, I need to use something like dsr.fields["name"] instead. Can anyone help please?

sforce.DescribeSObjectResult dsr = binding.describeSObject("Account");
Response.Write("Name: " + dsr.name + "<br>");
for (int i=0; i < dsr.fields.Length;i++)
{
sforce.Field field = dsr.fields[i]; //////////////////// Here I want to just use the field name?????????? so I don't have to query the entire table
Response.Write("Field name: " + field.name + "<br>");
Response.Write("Field label: " + field.label + "<br>");
if (field.nameField) Response.Write("This is a name field");
if (field.restrictedPicklist) Response.Write("This is a restricted picklist");
if (field.custom) Response.Write("This is custom field");
if (field.type.Equals(sforce.fieldType.picklist))
{
 Response.Write("Picklist values: <br>");
for (int j=0; j < field.picklistValues.Length; j++)
 Response.Write(">>" + field.picklistValues[j].
value + "<br>");
}
}

 

Thank you
Maz.

  • January 12, 2005
  • Like
  • 0

Hi everyone,

I'm very new to the sforce API and was wondering if someone can provide me a with sample code on how to delete an opportunity. The example in the API manual is

private void deleteAccount()

{

// Delete call takes an string array of Ids as parameter

String[] IDs = new Sring[] {""};

// Invoke the delete call, saving the result in a DeleteResult object
DeleteResult[] deleteResults = binding.delete(IDs);
// Determine whether the delete call succeeded or failed
if (deleteResults[0].success)
{
// Delete operation succeeded
System.Diagnostics.Trace.WriteLine("Deleted: " + deleteResults[0].id);
}
else
{
// Delete operation failed
System.Diagnostics.Trace.WriteLine("Couldn't delete because: " +
deleteResults[0].errors[0].message);
}
}

What I don't understand here is how does it know it's an Opportunity ID and not Contact ID? Can someone please provide me with an example of how to delete an Opportunity ID=123456

Thank you
Maz.

 

  • December 29, 2005
  • Like
  • 0

Hi,

Is it possible to define a new custom field as a lookup field. So that the contents of the field is dependent on another field? I want to create add a dropdown list and define as a lookup field with it's content being populated from all Account names.

Thank you
Maz.

 

  • January 18, 2005
  • Like
  • 0

Hi everyone,

I'm very new to the sforce API and was wondering if someone can provide me a with sample code on how to delete an opportunity. The example in the API manual is

private void deleteAccount()

{

// Delete call takes an string array of Ids as parameter

String[] IDs = new Sring[] {""};

// Invoke the delete call, saving the result in a DeleteResult object
DeleteResult[] deleteResults = binding.delete(IDs);
// Determine whether the delete call succeeded or failed
if (deleteResults[0].success)
{
// Delete operation succeeded
System.Diagnostics.Trace.WriteLine("Deleted: " + deleteResults[0].id);
}
else
{
// Delete operation failed
System.Diagnostics.Trace.WriteLine("Couldn't delete because: " +
deleteResults[0].errors[0].message);
}
}

What I don't understand here is how does it know it's an Opportunity ID and not Contact ID? Can someone please provide me with an example of how to delete an Opportunity ID=123456

Thank you
Maz.

 

  • December 29, 2005
  • Like
  • 0