Getting the Workflow Profile Text1 attribute value using BRApi

sfilho
New Contributor III

I am trying to get the Text1 field value using a Business Rule and put this value in a cube view that is being used as Form.

Does anyone have done this before? Is it possible to get the Text1 value from the Workflow Profile using BRApi?

Thanks for the help.

 

1 ACCEPTED SOLUTION

sfilho
New Contributor III

Yes it is ugly. I could not get this piece working properly:

GetAttributeValue(BRApi.Finance.Scenario.GetScenarioType(si, args.SubstVarSourceInfo.WFScenario.DimId).Id

I replaced with:

 

Dim wfClusterPK As WorkflowUnitClusterPk = si.WorkflowClusterPk

 

Dim wfScenarioTypeID As Integer = BRApi.Workflow.General.GetScenarioTypeId(si, wfClusterPK)

 

Dim sVarStep2 As String = BRApi.Workflow.Metadata.GetParent(si, args.SubstVarSourceInfo.WorkflowUnitInfo.ProfileName).GetAttributeValue(wfScenarioTypeID, 18000)

It brought the correctly value.

 

View solution in original post

15 REPLIES 15

db_pdx
Contributor III

Hi sfilho:

Are you only using the Text1 as a POV selection in the cube view?  If so, you can reference it directly in the Cube View as |WFText1|, no BR required.  Let us know if that satisfies your requirements.

Cheers    -DB

sfilho
New Contributor III

Helllo There, The Text1 field that I am using is at the level highlighted in red. Is not at the ".Forms" level.

Thank you for the help

sfilho_0-1667496598112.png

 

db_pdx
Contributor III

Add it to the Forms level?

sfilho
New Contributor III

😊That's what I said. Then I heard "Well than we will have to remember to update that field in every .Forms profile we create" then  I said "Yes you might want to remember that". Anyways this is stored somewhere in the database in a table. I would think that a method to get that information should exist right?

db_pdx
Contributor III

At least for our implementation we don't have too many distinct Form Templates so it is really only an initial setup thing in my opinion.  Also, a reminder: you should be adding more Forms to the Template.  Not creating new Templates for singular Forms.  This way any new form they add to the Form Template will already benefit from the metadata you are adding to that step.

Back to your original question, yes, we can get at it; it is just ugly.  Assuming usage in an XFBR String Business Rule

myString = BRApi.Workflow.Metadata.GetParent(si, args.SubstVarSourceInfo.WorkflowUnitInfo.ProfileName).GetAttributeValue(BRApi.Finance.Scenario.GetScenarioType(si, args.SubstVarSourceInfo.WFScenario.DimId).Id, 18000)

Where the Attribute Index is:

Text1 = 18000, Text2 = 20000, Text3 = 22000, Text4 = 24000

sfilho
New Contributor III

Yes it is ugly. I could not get this piece working properly:

GetAttributeValue(BRApi.Finance.Scenario.GetScenarioType(si, args.SubstVarSourceInfo.WFScenario.DimId).Id

I replaced with:

 

Dim wfClusterPK As WorkflowUnitClusterPk = si.WorkflowClusterPk

 

Dim wfScenarioTypeID As Integer = BRApi.Workflow.General.GetScenarioTypeId(si, wfClusterPK)

 

Dim sVarStep2 As String = BRApi.Workflow.Metadata.GetParent(si, args.SubstVarSourceInfo.WorkflowUnitInfo.ProfileName).GetAttributeValue(wfScenarioTypeID, 18000)

It brought the correctly value.

 

sfilho
New Contributor III

At the of the day I think this works. Thank you for the help!!

JackLacava
Community Manager
Community Manager

If you're in a XFBR, you should be able to use args.SubstVarSourceInfo.WFText1 .

 

sfilho
New Contributor III

Unfortunately the Text1 field I need to get the information from is not at the ".Forms" level.

Thank you for the help.

Hi,

A few months ago I used the recommended solution of 

Dim wfClusterPK As WorkflowUnitClusterPk = si.WorkflowClusterPk

Dim wfScenarioTypeID As Integer = BRApi.Workflow.General.GetScenarioTypeId(si, wfClusterPK)

Dim sVarStep2 As String =BRApi.Workflow.Metadata.GetParent(si,args.SubstVarSourceInfo.WorkflowUnitInfo.ProfileName).GetAttributeValue(wfScenarioTypeID, 18000)

And it gave me the correct value I was expecting, however, since moving to 7.3.1.14520 my cubeview BR will not retrieve the Text1 value from the WF.profile. Has the "18000" id value changed in this version ?

If I hard code my WF.Text1 value into my BR I can still pull my UD4.Textx value which alters by time and scenario, so unusual that the WF profile Text1 is not pulling through. I have tried recompiling as well as amending the variable names to see if that will kick it back to life.

Any thoughts as to why it will not work ?

Regards

Mark

 

Have a look in the backend database tables, they should tell you if that ID has changed.

Hi,

I tried searching through the database tables, but could not find anything relevant. I don't understand why the code worked to retrieve the Text1 field value a few months ago but does not work now. Nothing has changed in the Business Rule. 

 

Table WorkflowProfileAttributes will have the relevant properties, search for the value in the ProfileAttributeValue field to identify the record and then use the related AttributeIndex value.

Hi,

Well that confirmed it is still an index of 18000 for Text1, so I am at a loss now as to why the main script will not pull that value through. I cannot even get it to resolve for an errorlog entry. It just reports as 0. If I hard code my variable in my subsequent section then the rest of the code does what I expect and pulls a date specific value from the Text1 field. Very confusing.

Finally got this to work when I realised that it will not drive from "CubeViews" unless the particular sub profile of the entity profile has been activated in the workflow. I was "trying" to test it by running it from the cubeview menu and couldn't understand why sometimes it displayed my results when i changed entity and sometimes did not. Eventually I realised that it needed in this case to have the BS Analysis profile activated otherwise it would not retrieve the value in the Text1 field.