Community
Showing results for 
Search instead for 
Do you mean 
Reply

Add Rows to sub entity

Copper Contributor
Posts: 41
Country: USA

Add Rows to sub entity

I have tried to add rows using the following code and can not: Any ideas would be very great full.

 

 

        Dim LookupManager As AF.CustomEntities.CustomSubEntityManager(Of Lookup)
        Dim lookups As CustomEntityList(Of Lookup)
        Dim NewLookup As Lookup
        Dim bs As New BindingSource
        If LookupManager Is Nothing Then
            LookupManager = ActApp.ActFramework.CustomEntities.GetSubEntityManager(Of Lookup)(LookupDescriptor)
        End If
        lookups = LookupManager.GetCustomEntities(Nothing)
        If lookups IsNot Nothing Then
            lookups.FieldDescriptors.Add(LookupManager.GetCustomEntityFieldDescriptor("LookupWhat", AF.MutableEntities.FieldNameType.Alias))
            lookups.FieldDescriptors.Add(LookupManager.GetCustomEntityFieldDescriptor("FieldValueToMonitor", AF.MutableEntities.FieldNameType.Alias))
            lookups.FieldDescriptors.Add(LookupManager.GetCustomEntityFieldDescriptor("NewFieldValue", AF.MutableEntities.FieldNameType.Alias))
            bs.DataSource = lookups
            NewLookup = bs.AddNew
            NewLookup.SetGroups(ActApp.ActFramework.Groups.GetGroupAsGroupList(ACT_Utils.GetGroupByName(LookupPlugin.GROUP_NAME)))
            NewLookup.Fields.Item("LookupWhat", AF.MutableEntities.FieldNameType.Alias) = "Main"
            NewLookup.Fields.Item("FieldValueToMonitor", AF.MutableEntities.FieldNameType.Alias) = "ZIP Code"
            NewLookup.Fields.Item("NewFieldValue", AF.MutableEntities.FieldNameType.Alias) = "State"
            NewLookup.SetRecordManager(ActApp.ActFramework.CurrentUser)
            bs.MoveFirst()
            NewLookup.Update()

 

        Dim LookupManager As AF.CustomEntities.CustomSubEntityManager(Of Lookup)        

Dim lookups As CustomEntityList(Of Lookup)
        Dim NewLookup As Lookup        

Dim bs As New BindingSource
        If LookupManager Is Nothing Then            

LookupManager = ActApp.ActFramework.CustomEntities.GetSubEntityManager(Of Lookup)(LookupDescriptor)        

End If
        lookups = LookupManager.GetCustomEntities(Nothing)      


 If lookups IsNot Nothing Then
            lookups.FieldDescriptors.Add(LookupManager.GetCustomEntityFieldDescriptor("LookupWhat",
AF.MutableEntities.FieldNameType.Alias))            lookups.FieldDescriptors.Add(LookupManager.GetCustomEntityFieldDescriptor("FieldValueToMonitor", AF.MutableEntities.FieldNameType.Alias))             lookups.FieldDescriptors.Add(LookupManager.GetCustomEntityFieldDescriptor("NewFieldValue", AF.MutableEntities.FieldNameType.Alias))


            bs.DataSource = lookups            

NewLookup = bs.AddNew             NewLookup.SetGroups(ActApp.ActFramework.Groups.GetGroupAsGroupList(ACT_Utils.GetGroupByName(LookupPlugin.GROUP_NAME)))            NewLookup.Fields.Item("LookupWhat", AF.MutableEntities.FieldNameType.Alias) = "Main"             NewLookup.Fields.Item("FieldValueToMonitor", AF.MutableEntities.FieldNameType.Alias) = "ZIP Code"             NewLookup.Fields.Item("NewFieldValue", AF.MutableEntities.FieldNameType.Alias) = "State"             NewLookup.SetRecordManager(ActApp.ActFramework.CurrentUser)            

bs.MoveFirst()            

NewLookup.Update()

end if

 

Bob Lozinak

Bob Lozinak
Twelve/Three Marketing, Inc.
Software Developer