Article: AN0002460Updated: 09.05.2021
Following script will add user to a record column.
Example:
When creating a Project record we want to set actual user as a project manager, unless this field was already filled in, and we want to add this user also to the project team. Column ict-project-manager is a simple reference to a user. Column project_team is a multiple reference to users. This is why both are using a different syntax.
We will create a rule Before new record save (type Script) in the class Project.
var pi = OG.Person.GetLoginPerson().ToPersonInfo();
if (OGActualDataRow['ict-project-manager'] == null)
{
OGActualDataRow['ict-project-manager'] = pi;
}
var pil = OGActualDataRow['project_team'];
pil.Add(pi);