on 2016 Aug 22 3:38 PM
Dear Community,
I have been meddling with a weird error on one of my personal addons. The problem is, when I hit update button i get the following error
Below you can see the code of the Update Button;
private void Button0_PressedBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
{
BubbleEvent = true;
if (Application.SBO_Application.Forms.ActiveForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
{
int cnt = Grid4.Rows.Count;
int rowIndex, ok;
string CallID;
int count = Grid4.DataTable.Rows.Count - 1;
ProgressBar0 = Application.SBO_Application.StatusBar.CreateProgressBar("Checking Completed Service Calls", cnt - 1, false);
ProgressBar0.Value = 0;
for (int i = 0; i < cnt; i++)
{
try
{
showRow = int.Parse(Grid4.DataTable.Columns.Item("CallID").Cells.Item(i).Value.ToString());
ProgressBar0.Value = i;
ProgressBar0.Text = i + "/" + cnt + " - " + showRow;
}
catch { }
rowIndex = Grid4.GetDataTableRowIndex(i);
if (rowIndex != -1)
{
try
{
CallID = Grid4.DataTable.GetValue("CallID", rowIndex).ToString();
oSCs = ((SAPbobsCOM.ServiceCalls)(Globals.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oServiceCalls)));
oSCs.GetByKey(int.Parse(CallID));
oSCs.UserFields.Fields.Item("U_Completed").Value = Grid4.DataTable.GetValue("Completed", rowIndex).ToString();
oSCs.UserFields.Fields.Item("U_SalesOrder").Value = Grid4.DataTable.GetValue("Sales Order", rowIndex).ToString();
ok = oSCs.Update();
if (ok != 0)
{
Application.SBO_Application.MessageBox(Globals.oCompany.GetLastErrorDescription().ToString(), 1, "Ok", "", "");
}
}
catch { ProgressBar0.Stop(); }
}
}
ProgressBar0.Stop();
}
}
What i noticed though, is that this is caused whenever i use CFL (Choose From List). Here is the CFL Feature i use
The Properties of the EditText Field are:
The CFL datasource properties are:
Any Ideas why this happens?
Hi Varnavas,
Did you assign your form object type as '2'?
Can you post the screen shot of your form properties
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varnavas,
If you are not using B1Studio for Visual Studio / SBO 9+
follow the sample in your SDK help
C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM UI\CSharp\17.ChooseFromList
If you are using SBO9+ and using the new Framework,
Follow the above sample, but instead of these lines :
SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
oCFLEvento = ( ( SAPbouiCOM.IChooseFromListEvent )( pVal ) );
Use
SAPbouiCOM.ISBOChooseFromListEventArg oCFLEvento = SAPbouiCOM.ISBOChooseFromListEventArg)pVal;
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varnavas,
First of all , a silly question, BP Code 140313 exist in the database?
Secondly, -Linked Value Not Exist- error may caused for the following reasons:
In any case, i want to ask you; the link button that is not working is located at the EditText or at the Grid? Because in case that you have placed it on the grid, make sure that the link button is anchored with BP Code and not CardName. You are not having a CardCode column. In case that you have a Link Button that is connected with the Editext (at the top of the form) even with the EditText contains data, is one other problem.
Kind Regards
Evangelos D. Plagianos
Dear Vaggelis,
Yes, the BP selection filters the results on the grid, so it does exist no worries about silly questions. Many times we all face small simple problems like that one!
I use Int.Parse and i parse from string to Int. The linked button works fine.
The use of Update Button is completely irrelevant with the EditText field with the CFL.
CFL EditText field works as a FILTER for the query that will be run on the grid.
when i issue a change on the grid enabled fields, the "1" button changes to Update.
When i click update the event triggered is correct i just get an extra error below which i show on the first screenshot.
The second screenshot below pops that error when i have a value in the EditText on the top and i click update
Hello Varnavas,
Have you checked the below discussion? It seems another member managed to resolve the same issue you are having.
How to add a user defined field to Business Par... | SCN
Kind Regards,
Atilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It appears to be irrelevant with the current subject. No other form is active during the editing of the SCs. Before I add the CFL feature, i wouldn't get any errors. I would like to keep the CFL feature though. By the way, the code executes fine most of the times while sometimes it will not do the update of the SCs. Error always appears.
After you run oSCs.GetByKey(int.Parse(CallID)); try to get the oSCs.CustomerCode value to see what you have there.
Do you have any UDO linked to your form?"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
8 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.