Forum Discussion

MZ's avatar
MZ
New Contributor III
3 years ago

How to change scenario ReadWriteDataGroup through API

We are trying to temporarily disable the Write access on a scenario to Everyone during a long DM sequence. We were able to find the ManageDataGroup under Scenario Properties, however, we could not find anything for ReadWriteDataGroup, which is a XMLConstants based on the API reference. Any help appreciated!

  • RWDataGroup is not a variable property, but rather an actual property of the member. To edit it, you need to create a WritableMember object and save that.

    ' retrieve your original scenario somehow, this comes from the current Workflow
    Dim myScen As Member = BRApi.Finance.Members.GetMember(si, dimtype.Scenario.Id, si.WorkflowClusterPk.ScenarioKey)
    ' set up a writable object
    Dim newScen As New WritableMember(myscen)
    ' change properties, including ReadWriteDataGroup
    newScen.Name = "ABC"
    ' when done, save it back.
    brapi.Finance.MemberAdmin.SaveMemberInfo(si, True, newScen, False, Nothing, False, Nothing, False)
    	
  • JackLacava's avatar
    JackLacava
    Honored Contributor

    RWDataGroup is not a variable property, but rather an actual property of the member. To edit it, you need to create a WritableMember object and save that.

    ' retrieve your original scenario somehow, this comes from the current Workflow
    Dim myScen As Member = BRApi.Finance.Members.GetMember(si, dimtype.Scenario.Id, si.WorkflowClusterPk.ScenarioKey)
    ' set up a writable object
    Dim newScen As New WritableMember(myscen)
    ' change properties, including ReadWriteDataGroup
    newScen.Name = "ABC"
    ' when done, save it back.
    brapi.Finance.MemberAdmin.SaveMemberInfo(si, True, newScen, False, Nothing, False, Nothing, False)
    	
    • MZ's avatar
      MZ
      New Contributor III

      Sorry I got side track until today. It works! Thanks a lot.

    • MZ's avatar
      MZ
      New Contributor III

      Thanks. I will try it in a bit!

    • BhavayMangla's avatar
      BhavayMangla
      New Contributor II

      Is there a similar way to change the text1 field of a member using the similar logic?