Skip to Content
0

Problem in add sale opportunity stages di api

Mar 22, 2017 at 04:25 AM

53

avatar image

Hi

Am trying to add new sale opportunity stages by using below code.

But it is updating existing row only.

If is there any wrong, please let me know.

Dim sales As SAPbobsCOM.SalesOpportunities = DirectCast(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities), SAPbobsCOM.SalesOpportunities)


If sales.GetByKey(oOpportunity) Then
sales.Lines.SetCurrentLine(sales.Lines.Count - 1)
sales.Lines.PercentageRate = 100
sales.Lines.StageKey = 33
sales.Lines.StartDate = DateTime.Today
sales.Lines.ClosingDate = oDeliveryDate
sales.Lines.Add()

If sales.Update <> 0 Then
Dim error1 As String = oCompany.GetLastErrorDescription
show += error1
show += "');"
ScriptManager.RegisterStartupScript(Me, [GetType](), "Show", show, True)
End If

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

DIEGO LOTHER Mar 23, 2017 at 01:16 AM
0

Hi Nandappa,

If this statements

sales.Lines.PercentageRate = 100
sales.Lines.StageKey = 33
sales.Lines.StartDate = DateTime.Today
sales.Lines.ClosingDate = oDeliveryDate

should create a new stage, the correct code must be this:

sales.Lines.SetCurrentLine(sales.Lines.Count - 1)
sales.Lines.Add()
sales.Lines.PercentageRate = 100
sales.Lines.StageKey = 33
sales.Lines.StartDate = DateTime.Today
sales.Lines.ClosingDate = oDeliveryDate

Hope it helps.

Kind Regards,

Diego Lother

Share
10 |10000 characters needed characters left characters exceeded