Skip to Content
0
Former Member
Jul 01, 2013 at 10:03 AM

Get Current User Information while creating e.g. a CustomerQuote

294 Views

Hi there,

i just created a extension for the BO CustomerQuote where I put the following elements:

[Extension] businessobject AP.CRM.Global:CustomerQuote raises DebugInfo {

element EmloyeeId : EmployeeID;

element EmployeeName : LANGUAGEINDEPENDENT_EXTENDED_Text;

element EmployeeForname : LANGUAGEINDEPENDENT_EXTENDED_Text;

element EmployeePhoneNumber : LANGUAGEINDEPENDENT_EXTENDED_Text;

}

Then I created the Script-File "Event - BeforeSave" for the root-context. In this event i want to put the current information of the user which is currently loggedin. This is the coding:

var userUUID = Context.GetCurrentIdentityUUID();

raise DebugInfo.Create("W", userUUID.content.ToString() , "", "");

var query = BusinessPartner.QueryByIdentification;

var selParams = query.CreateSelectionParams();

var queryResult;

selParams.Add(query.UUID.content, "I", "EQ", userUUID.content);

queryResult = query.Execute();

var bp : BusinessPartner;

foreach( bp in queryResult ) {

this.EmloyeeId.content = bp.Identification.GetFirst().BusinessPartnerID;

this.EmployeeName = bp.Common.GetFirst().Person.Name.FamilyName;

this.EmployeeForname = bp.Common.GetFirst().Person.Name.GivenName;

this.EmployeePhoneNumber = "121";

break;

}

Unfortunalety the bp is empty. Is there any other way to determine the current user?

Thanks for responding and best regards,

Daniel Gegenheimer