Skip to main content
June 24, 2022
Solved

Updating scenario member through an extensibility rule

  • June 24, 2022
  • 2 replies
  • 0 views

Hi All,

Need some help in updating properties of scenario member through an extensibility rule.

'Workflow Time

scenarioProperties.WorkflowTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetCycleFirstQuarter(si, api)))

 

'Workflow Start Time
scenarioProperties.WorkflowStartTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowStartTimeForScenario(si, api)))

 

'Workflow End Time
scenarioProperties.WorkflowEndTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowEndTimeForScenario(si, api)))

 

The rule compiles fine however fails on execution.

Error message received: Error updating member. Invalid parameter 'WorkflowTime'.

Would someone please guide me with the correct way to achieve this?

Best answer by ChristianW

Hi Bharti

I don't think, that in this case, you can use the SetStoredValue function, you need to use the SetStoredPropertyItem function.

This sample works:

Dim scenarioMember As Member = BRApi.Finance.Members.GetMember(si, dimtypeid.Scenario, "Actual")
Dim scenarioMemberInfo As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si, dimtypeid.Scenario, scenarioMember.Name, True)
Dim scenarioProperties As ScenarioVMProperties = scenarioMemberInfo.GetScenarioProperties

Dim rateHistorical As FxRateType = BRApi.Finance.Data.GetFxRateType(si, "HistoricalRate")
Dim scenarioPropertyItem As New VaryingMemberPropertyItem (cubetypeid.Unknown, scenariotypeid.Unknown, dimtypeid.Unknown, False, PropStorageType.GuidType, rateHistorical.UniqueID)
scenarioProperties.FxRateTypeForAssetLiability.SetStoredPropertyItem(scenarioPropertyItem)

brapi.Finance.MemberAdmin.SaveMemberInfo(si, scenarioMemberInfo, False, True, False, False)

I hope this helps

 

Can  you do us a favor and answer the first question yourself? The community should become a repository of knowledge, and it needs answered questions. The more the better it will get.

2 replies

June 24, 2022

I could get these working. 

 

Facing issue now in updating FxRateTypeForAssetLiability property

scenarioProperties.FxRateTypeForAssetLiability.SetStoredValue(GetRateTypeID(si, api))

Issue : GetRateTypeID gives UniqueID of rate which is of type GUID.

FxRateTypeForAssetLiability.SetStoredValue() needs integer as input. I am struggling to convert this GUID to Integer.

 

Any leads would be appreciated.

ChristianW PeterFu , any thoughts please?

June 26, 2022

Hi Bharti

I will have a look at it tomorrow, but ratetype and fxratetype might not be the same.

Cheers

 

 

June 27, 2022

Hi Bharti

I don't think, that in this case, you can use the SetStoredValue function, you need to use the SetStoredPropertyItem function.

This sample works:

Dim scenarioMember As Member = BRApi.Finance.Members.GetMember(si, dimtypeid.Scenario, "Actual")
Dim scenarioMemberInfo As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si, dimtypeid.Scenario, scenarioMember.Name, True)
Dim scenarioProperties As ScenarioVMProperties = scenarioMemberInfo.GetScenarioProperties

Dim rateHistorical As FxRateType = BRApi.Finance.Data.GetFxRateType(si, "HistoricalRate")
Dim scenarioPropertyItem As New VaryingMemberPropertyItem (cubetypeid.Unknown, scenariotypeid.Unknown, dimtypeid.Unknown, False, PropStorageType.GuidType, rateHistorical.UniqueID)
scenarioProperties.FxRateTypeForAssetLiability.SetStoredPropertyItem(scenarioPropertyItem)

brapi.Finance.MemberAdmin.SaveMemberInfo(si, scenarioMemberInfo, False, True, False, False)

I hope this helps

 

Can  you do us a favor and answer the first question yourself? The community should become a repository of knowledge, and it needs answered questions. The more the better it will get.

June 27, 2022

Thanks a lot Christian, I will give this a try. 

Syntax for setting workflow time, workflow start time and workflow end time is as below:

 

scenarioProperties.WorkflowTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetCycleFirstQuarter(si, api).ToString.Replace("T#","")))
scenarioProperties.WorkflowStartTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowStartTimeForScenario(si, api)))
scenarioProperties.WorkflowEndTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowEndTimeForScenario(si, api)))

I was just passing incorrect member name earlier which was causing the update to fail.