Forum Discussion

manthangandhi's avatar
manthangandhi
New Contributor III
2 years ago

Assistance Needed: Updating "Profile Active" Property via Extender Rule

 

Dear Team,

I am currently working on updating the "Profile Active" property for a specific scenario type within a workflow profile. I am trying to implement this change using the below code snippet, but am not seeing the desired result:

code snippet:

brapi.Workflow.Metadata.GetProfile(si, "Parent Profile.Profile Name").SetAttributeValue(ScenarioType.Control.Id, 1300, Boolean.TrueString)

Though I am aware that this update can be performed manually by accessing individual workflow profiles or using the grid view, my requirement is to execute this task through an extender rule.

I've identified that the attribute index for "Profile Active" is 1300 and the value to be updated is of an object type. I suspect there may be an issue with the way I'm passing the new value in the code.

I would appreciate any guidance or insight on how to correctly update this property using the extender rule.

Your assistance is greatly appreciated.

Thanks

 

6 Replies

  • fede27's avatar
    fede27
    New Contributor II

    For a client we have to perform the same activity, set "Profile Active" dynamically via BR. Did you find a way to do so? 

  • DanielWillis's avatar
    DanielWillis
    Valued Contributor

    I'm not sure you're passing the right parameter in the first position. What is ScenarioType.Control.Id supposed to be?

    If it is a specific scenario type you know ahead of time then you could use something like ScenarioTypeId.Budget.

    Otherwise one of the methods to obtain the scenariotypeid from current wf/global/wherever, e.g. brapi.Workflow.General.GetScenarioTypeId(...)

     

     

  • FredLucas's avatar
    FredLucas
    Contributor III

    Hi, 

    The SetAttributeValue function only updates the settings temporarily, it does not store them in the database.

    There's an open enhancement request asking for a way to have these updates committed to the database.

    In the meantime, although fairly complex, a workaround solution for it would be to automate the production and load of an xml file containing the attribute values you are looking for.

    Regards,

    Fred

     

    • manthangandhi's avatar
      manthangandhi
      New Contributor III

      Hi Fred,

      Is there any alternate way to perform this usinng database, anyclue on this?

      • DanielWillis's avatar
        DanielWillis
        Valued Contributor

        The properties are all there in the WorkflowProfileAttributes table... You might get some frowns from updating it on here but if its working around a bug then maybe it is the best way. You might need to run the setAttributeValue as well if that command is doing an in-memory/cache update as your DB table change might not be visible to clients (and perhaps even get overwritten? not sure).