Skip to main content
September 22, 2025
Question

Show Plug Account property for an Account on UD

  • September 22, 2025
  • 0 replies
  • 0 views

The below code returns the Plug Account name for an Account, taken from the Plug Account property on the Account
It is a DynamicCalc on UD8. Set up a U8 member, f.ex. "YourName" 

Api.Account.GetPlugAccount returns a long string that contains the Plug Account Name

For each Account that has a Plug Account, the string will contain "DimId: 22", so this can be used as filter.
The Plug Account name will be stated directly after "Name: ", so this can be extracted from the string. In the below example, "NA" is returned where there is no Plug Account.

The Plug Account Name will be shown when using V#Annotation:U8#YourName on Accounts

----------------------------------------------

Dim AccPlugAccName As String = ""

' Fetch the Plug Account property
Dim fetchedValue As String = Api.Account.GetPlugAccount(Api.Pov.Account.MemberId)?.ToString()

' Check if the fetched string is not null/empty and contains "DimId: 22"
If Not String.IsNullOrEmpty(fetchedValue) AndAlso fetchedValue.Contains("DimId: 22") Then
    ' Extract only the value after "Name: " and before the next comma
    Dim startIndex As Integer = fetchedValue.IndexOf("Name: ") + "Name: ".Length
    Dim endIndex As Integer = fetchedValue.IndexOf(",", startIndex)
    AccPlugAccName = fetchedValue.Substring(startIndex, endIndex - startIndex).Trim()
Else
    ' Assign "NA" if the condition is not met
    AccPlugAccName = "NA"
End If

' Return the result
Return AccPlugAccName