1. Script for finding out current user

    Article: AN0001906Updated: 12.03.2020

    Reading current user

    Below script returns instance of Person object for current user.
    var p = OG.Person.GetLoginPerson();
    In order to save the user in the record (DataRow) it is necessary to convert it to type PersonInfo.
    dr['og_user'] = OG.Person.GetLoginPerson().ToPersonInfo();


    Reading extended user properties

    In case you have configured class for extending user properties, you can read its data for particular user. The below example shows how to read data from column manager that is created in the class.

    V příkladu níže je dr je libovolný záznam z libovolné třídy, která má sloupci solver typu odkaz na uživatele.

    var p = dr['solver'];
    var manager = null;
    if ( p != null)
    {
      var pDr = OG.DataRow.GetPersonDataRow(p.Id);
      if ( pDr != null)
      {
        manager = pDr['manager'];
      }
    }

×