We are under construction!

You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.

Knowledge Base Article

Extender: Auto Create Member

This snippet will create a new Account member, including setting some properties that can vary by Scenario Type and/or Time.

Note: SaveMemberInfo does not create entries in Audit tables, which means the Audit Metadata report will not contain anything related to this operation. For this reason, we do not recommend to use this snippet outside of implementation activities or in production environments.

'Create a new MemberInfo object with its child objects.
Dim objMemberPk As New MemberPk(DimType.Account.Id, DimConstants.Unknown)

'Update Dim Name accordingly
Dim objDim As OneStream.Shared.Wcf.Dim = BRApi.Finance.Dim.GetDim(si, "<Dimension Name>")

'Create New Member
Dim objMember As New Member(objMemberPk, _
	"<New Member Name>", "<Member Description>", objDim.DimPk.DimId)

'Create VaryingMemberProperties object
Dim objProperties As New VaryingMemberProperties( _
	objMemberPk.DimTypeId, objMemberPk.MemberId, DimConstants.Unknown)

'Create new member info object for new member
Dim objMemberInfo As New MemberInfo( _
	objMember, objProperties, Nothing, objDim, DimConstants.Unknown)

'Modify some member properties. Account dimension, in this example.
Dim accountProperties As AccountVMProperties = objMemberInfo.GetAccountProperties()
accountProperties.AccountType.SetStoredValue(AccountType.Revenue.Id)
accountProperties.Text1.SetStoredValue( _
	ScenarioType.Unknown.Id, DimConstants.Unknown, "MyNewText1Value")

'Save the member and its properties.
Dim isNew As TriStateBool = TriStateBool.TrueValue
BRApi.Finance.MemberAdmin.SaveMemberInfo(si, objMemberInfo, True, True, False, isNew)
Updated 2 years ago
Version 3.0