Public Sub AddActionAttribute()

   

   Dim oAction As CAction

   Set oAction = New CAction

   oAction.Init REApplication.SessionContext

   

   'Load action using system record ID

   oAction.Load 878

   

   Dim REservice As REservices

   Set REservice = New REservices

   REservice.Init REApplication.SessionContext

   

   Dim ogAttribute As IBBAttribute

   Dim lattID As Long

   

   Dim oaTs As CAttributeTypeServer

   Set oaTs = REservice.CreateServiceObject(bbsoAttributeTypeServer)

   oaTs.Init REApplication.SessionContext

   

   'Get the ID of the attribute that will be added

   lattID = oaTs.GetAttributeTypeID("Dietary Preference", bbAttributeRecordType_ACTION)

   

   Set ogAttribute = oAction.Attributes.Add

   ogAttribute.Fields(Attribute_fld_ATTRIBUTETYPES_ID) = lattID

   ogAttribute.Fields(Attribute_fld_VALUE) = "Vegan"

   

   oAction.Save

   

   oAction.CloseDown

   Set oAction = Nothing

   

   REservice.CloseDown

   Set REservice = Nothing

   

   Set oaTs = Nothing

   Set ogAttribute = Nothing

   

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.