I have had this code for years now, but now with version 11.13 the RowVisibleForHelper no longer exists. What can I do now?
SelectionRow selc = SelectionRow.CreateNew();
selc.SetDefaultsAsync();
selc.Name = details.SelectionName;
selc.Seltype = 0; //static
selc.TargetTableNumber = details.TargetTableNumber;
selc.SaveAsync();
int group = SoContext.CurrentPrincipal.GetGroupId();
if (details.GroupId != 0)
group = details.GroupId;
switch (details.Visibility)
{
case VisibilityMode.All:
RowVisibleForHelper.SetVisibleFor(selc, RowVisibleForHelper.VisibleFor.All);
break;
case VisibilityMode.Group:
RowVisibleForHelper.SetVisibleFor(selc, RowVisibleForHelper.VisibleFor.Group, group);
break;
case VisibilityMode.Private:
RowVisibleForHelper.SetVisibleFor(selc, RowVisibleForHelper.VisibleFor.Private);
break;
}
Allt Svar (2)
EntityVisibleForHelper inside namespace SuperOffice.CRM.Entities seems like the logical replacement?
I ended with this code, because the SelectionRow does not contain a visible for and the SelectionEntity does not contain a TargetTable (set). I am sure it works, but it would be nice to have it as one save, not two.
Am I doing something wrong?
SelectionRow selrow = SelectionRow.CreateNew();
await selrow.SetDefaultsAsync();
selrow.Name = details.SelectionName;
selrow.Seltype = 0; //static
selrow.TargetTableNumber = details.TargetTableNumber;
await selrow.SaveAsync();
Selection sel = await Selection.GetFromIdxSelectionIdAsync(selrow.SelectionId);
EntityVisibleForHelper visfor = sel.VisibleForHelper;
switch (details.Visibility)
{
case VisibilityMode.All:
visfor.VisibleFor = Visibility.All;
break;
case VisibilityMode.Group:
visfor.VisibleFor = Visibility.Group;
break;
case VisibilityMode.Private:
visfor.VisibleFor = Visibility.Associate;
break;
}
await sel.SaveAsync();