Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Obviously the first problem to solve is getting the unique ID for the Legal Entity. Unique ID's in BFS are called BrickId's. At the time of this writing there is no way to view the BrickId for a LegalEntity in BFS (this is being added shortly) so the only way to do this is via the API method GetPersons.

In my instance of BFS I have a default user with username bnuser and I would like to get the BrickId of this user via GetPersons, see code below.

Code Block
languagec#
themeRDark
titleC# - Get legal entity details using username as input
linenumberstrue
var client = new BFSServiceReference.bfsapiSoapClient();
var credentials = new BFSServiceReference.Credentials()
{
    UserName = bfsusername, //Username of administrative user in your instance of BFS
    Password = bfspassword, //Password of the administrative user in your instance of BFS
};
var persons = client.GetPersons(new BFSServiceReference.GetPersonRequest()
{
    Credentials = credentials,
    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS  
 
    Args = new BFSServiceReference.GetPersonArgs()
    {
      UserName  = "bnuser",
    },
   
    Fields = new BFSServiceReference.GetPersonFields()
    {
        BrickId = true,
        UserName = true,
        FirstName = true,
        LastName = true,
    },
});
foreach (var c in persons.Result)
{
    Console.WriteLine(c.BrickId + "," + c.FirstName + "," + c.LastName);
}