• CEC Dev
  • NEWBIE
  • 0 Points
  • Member since 2004

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

This is a second problem that I'm having while attempting to create a new Opportunity.

I am populating the RecordTypeId property with the following line:

opp.RecordTypeId = SalesForceDataProvider.GetRecordType(order.Channel).Id;

...where the order.Channel will either be "Wholesale" or "Retail Sale". The code for GetRecordType is:

public static RecordType GetRecordType(string channel)
{
QueryResult qr =
null;
try
{
qr = salesForce.query(
string.Format("select Id from RecordType where (Name = '{0}')", channel));
}
...

The code is retrieving a valid id from the RecordType object. What's odd is that when order.Channel = "Retail Sale", I do not get this error. It only occurs when order.Channel = "WholeSale". Clearly, I'm pulling the right record because the value in the error message indicates a valid value was returned (0123000000004MgAAI). So, what could be the problem here???

Thanks,

-- Tom

  • September 16, 2004
  • Like
  • 0

I'm testing stage two of a console app to update data in salesforce with data from our order entry system (stage one was to add/update accounts).

I am populating an opportunity from a sales order with the following code:

protected bool FillOpportunity(ref Opportunity opp, Order order)
{
try
{
if (opp.Id == null)
{
// This is a new opportunity that must be filled
Account account = SalesForceDataProvider.GetAccount(order.o_pnumber);
if (account != null)
{
opp.AccountId = account.Id;
opp.OwnerId = account.OwnerId;
opp.CloseDate = order.o_shipped;
opp.LeadSource = "OE";
// Order Entry
opp.Name = "OE: " + order.Id;
opp.RecordTypeId = SalesForceDataProvider.GetRecordType(order.Channel).Id;
opp.Type = order.Account.p_category;
}
else
return false;
}
// Both new and existing opportunities should have the following fields updated here
opp.Amount = (double)order.TotalAmount;
opp.ordernumber__c = order.Id;
opp.StageName = "Closed Won";
return true;
...

As you can see, I am prividing a CloseDate, but the create method returns an error result indicating that the CloseDate is missing. I have tried assigning it the current date (DateTime.Now) as well as not assigning it a value at all and still get the same result.

Any ideas???

Thanks,

-- Tom

  • September 16, 2004
  • Like
  • 0

This is a second problem that I'm having while attempting to create a new Opportunity.

I am populating the RecordTypeId property with the following line:

opp.RecordTypeId = SalesForceDataProvider.GetRecordType(order.Channel).Id;

...where the order.Channel will either be "Wholesale" or "Retail Sale". The code for GetRecordType is:

public static RecordType GetRecordType(string channel)
{
QueryResult qr =
null;
try
{
qr = salesForce.query(
string.Format("select Id from RecordType where (Name = '{0}')", channel));
}
...

The code is retrieving a valid id from the RecordType object. What's odd is that when order.Channel = "Retail Sale", I do not get this error. It only occurs when order.Channel = "WholeSale". Clearly, I'm pulling the right record because the value in the error message indicates a valid value was returned (0123000000004MgAAI). So, what could be the problem here???

Thanks,

-- Tom

  • September 16, 2004
  • Like
  • 0

I'm testing stage two of a console app to update data in salesforce with data from our order entry system (stage one was to add/update accounts).

I am populating an opportunity from a sales order with the following code:

protected bool FillOpportunity(ref Opportunity opp, Order order)
{
try
{
if (opp.Id == null)
{
// This is a new opportunity that must be filled
Account account = SalesForceDataProvider.GetAccount(order.o_pnumber);
if (account != null)
{
opp.AccountId = account.Id;
opp.OwnerId = account.OwnerId;
opp.CloseDate = order.o_shipped;
opp.LeadSource = "OE";
// Order Entry
opp.Name = "OE: " + order.Id;
opp.RecordTypeId = SalesForceDataProvider.GetRecordType(order.Channel).Id;
opp.Type = order.Account.p_category;
}
else
return false;
}
// Both new and existing opportunities should have the following fields updated here
opp.Amount = (double)order.TotalAmount;
opp.ordernumber__c = order.Id;
opp.StageName = "Closed Won";
return true;
...

As you can see, I am prividing a CloseDate, but the create method returns an error result indicating that the CloseDate is missing. I have tried assigning it the current date (DateTime.Now) as well as not assigning it a value at all and still get the same result.

Any ideas???

Thanks,

-- Tom

  • September 16, 2004
  • Like
  • 0