Forum Discussion

vignesh's avatar
vignesh
New Contributor II
9 months ago

WorkFlow's Hierarchy Level Details in Business Rule

Can anyone share brapi command to fetch the Workflow's Hierarchy Level in the Business Rule?  

 

  • Not sure what that is, is it BRApi.Workflow.Metadata.GetProfile(si, "Your profile name").Level , by any chance...?

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    Not sure what that is, is it BRApi.Workflow.Metadata.GetProfile(si, "Your profile name").Level , by any chance...?

    • Krishna's avatar
      Krishna
      Valued Contributor

      Yes, it works. Thank you JackLacava 

       

      Dim a As Integer = BRApi.Workflow.Metadata.GetProfile(si,"GL Data load COPR STD.Import").Level
      brapi.ErrorLog.LogMessage(si,A & "Value")

       

       

       

  • MarcusH's avatar
    MarcusH
    Contributor III

    I don't think there is a BRApi object for managing/viewing the Workflow properties. The MarketPlace app XFW Reporting Compliance (RPTA) queries the workflow set up but uses a direct SQL call. Here is an example:

     

            Public Function WfProfile_DescAdjChild(ByVal si As SessionInfo, ByVal strProfileKey As String) As DataTable
                Try
    
                    'Define the SQL Statement
                    Dim sql As New Text.StringBuilder
    
                    sql.Append("SELECT ")
                    sql.Append("ProfileKey,  ")
                    sql.Append("ProfileName As Name,  ")
                    sql.Append("ProfileType ")
                    sql.Append("FROM  ")
                    sql.Append("WorkflowProfileHierarchy ")
                    sql.Append("Where  ")
                    sql.Append("ProfileType = 51 ")
                    sql.Append("And ProfileKey In (" & strProfileKey & ") ")
                    sql.Append("ORDER BY  ")
                    sql.Append("HierarchyIndex ")
    
                    'Execute the query
                    Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
                        Dim dt As DataTable = BRApi.Database.ExecuteSql(dbConnApp, sql.ToString, False)
                        dt.TableName = "WorkflowProfiles"
                        Return dt
    
                    End Using
    
                    Return Nothing
                Catch ex As Exception
                    Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
                End Try
            End Function

     

    • vignesh's avatar
      vignesh
      New Contributor II

      Thanks Marcus, I was able to use SQL and get it, but checking if there is any inbuilt command to grab it. 

      • Krishna's avatar
        Krishna
        Valued Contributor

        vignesh  - I tried yesterday could not find. If I find anything will post here.