cfl starts one more time per row




I created a dynamic cfl in salesorder.

Per line it should create a CFL based on the ItemCode. Everything works fine with on little exeption:

Per line, the CFL starts one more time.

That means, in der first line, everything works well.

In the second line, the first result AND the second result comes up.

In the Third line comes the first, the second and the third result and so on.

How can i get just the right single result per line?


My Set up:

I created a CFL with the Coresuite CFL function.

Then  i´ve done following things:

I have customized the Settings in the new Customizerule:

Trigger: Form 139, Item 38, Column 1, Event Value changed.


And here the code:

// Created by coresuite customize wizard

string ItemCode = Matrix.GetFromUID(pVal.Form, "38").GetDisplayValue("1", pVal.Row -1).ToString();
string itemUID = "38"; string columnID = "U_Verpackungsart";
string query = "select OPKG.PkgType, ITM4.QtyPerPack from ITM4 inner join OPKG on ITM4.PkgCode = OPKG.PkgCode where ItemCode = '" + ItemCode + "' and ITM4.UomType = 'S'";
string writeBackColumn = "PkgType";

// Create CFL and add it to the field
SwissAddonFramework.UI.Dialogs.ChooseFromList cfl =
new SwissAddonFramework.UI.Dialogs.ChooseFromList(
new SwissAddonFramework.UI.Dialogs.ChooseFromList.DefaultSQLQuery(query)
, writeBackColumn
, true
, true
, Matrix.GetFromUID(pVal.Form, itemUID), "U_Verpackungsart");

catch(System.Exception ex) // Error handling
MessageBox.Show("Error while adding the cfl to the field (coresuite customize wizard): " + ex.Message, "OK");

// Return value: true if all ok, false if you want SAP B1 to stop proceed
return true;

What can i do?

Anders Olsson

Hi Markus,


The effect of your code is that every time the value changes the code triggers and a new CFL is created. So for every time the rule runs and additional CFL is shown.

That's why the wizard sets the trigger to the FormLoad event -> the CFL is only registered once.

Why was that approach not working in your case?




Anders Olsson

OK, I got the idea from your previous post: you need the query to be dynamic. In that case I would leave the trigger as FormLoad and change the query when the itemcode changes instead.

That could be accomplished by keeping a static dictionary of CFLs in the extended code.


Extended code:

public static System.Collections.Generic.Dictionary<string, SwissAddonFramework.UI.Dialogs.ChooseFromList> clfList = new System.Collections.Generic.Dictionary<string, SwissAddonFramework.UI.Dialogs.ChooseFromList>();

(The string would be the FormUID).


So when the CFL has been created add it to the dictionary.


Create another rule triggered by ItemCode change. There, change the query of the CFL.


I would be good practice to remove the CFL from the dictionary when closing the form.





Hello Anders,

I'm going to do what you describe in your post. The CFL should only contain values based on a specific ItemCode. My previous attempt fails because the query is not created dynamically.

I created an dictionary of CFL in the extended code. But how can I add the CFL to the dictionary?

How can I remove the CFL from the dictionary when closing the form?




Please sign in to leave a comment.

Didn't find what you were looking for?

New post