Home > Forum > Plugins > How to add rows to item list using sdk BPS 2020 Extension Logic- BPS ItemList Extension Logic? (not empty rows)

How to add rows to item list using sdk BPS 2020 Extension Logic- BPS ItemList Extension Logic? (not empty rows)
0

What type should be predefined in the input parameters to read a type field itemlist/enum in a sdk BPS 2020 Exteinsion Logic- BPS Custom Action utilizand ConfigEditableEnum/ ConfigEditableItemList?

MVP

Hi,

I'm not sure that I understand you so my answer may be off.
Enum should be used if you want to select one option of a predefined set of options like User or Group.
If I remember correctly the Item List type allows the user to choose one of the existing item lists. So you could use this to select the correct one.

Sample for adding a row:
var list = document.ItemsLists.GetByID(int.Parse(Configuration.TargetConfiguration.TargetItemListId));
var newRow = list.Rows.AddNewRow();
newRow.Cells.GetByDbColumnName("some Column").SetValue(targetValue);
WebCon.WorkFlow.SDK.Documents.DocumentsManager.UpdateDocument(new WebCon.WorkFlow.SDK.Documents.Model.UpdateDocumentParams(document));

Best regards,
Daniel

MVP
In reply to: Iulian Amaricai

Thanks for the reply!
I used the received code using as sdk library BPS 2020 Custom Action, but to associate a sdk at the ITEMLIST level you must use the sdk library BPS 2020 Item List Extension Logic. Is it possible to update rows or add a new row to an itemlist in the sdk library BPS 2020 Item List Extension Logic?

Hi Iulian,

ah, now I know where you are. I haven't used this option myself.

As far as I can tell is, you can only do it when the overridden methods are executed:
OnAfterElementSave
OnBeforeElementDelete
OnBeforeElementSave
Validate
VerifySaveRestrictions

public class ItemListExtensionLogic1 : ItemListExtension<ItemListExtensionLogic1Config>
{

public override void OnBeforeElementSave(BeforeSaveParams<ItemListExtensionContext> args)
{
var newRow = args.Context.CurrentItemsList.Rows.AddNewRow();
}

}

Best regards,
Daniel