cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

try this.

var current_emp_uuid = Context.GetCurrentIdentityUUID();

var bupa_uuid = Identity.Retrieve(current_emp_uuid).BusinessPartnerUUID;

var current_employee_name = Employee.Retrieve(bupa_uuid).CurrentCommon.BusinessPartnerFormattedName;

Former Member
0 Kudos

Hi Asif,

this was the correct way. Thank you for your fast respond

Thanks and Regards,

Daniel Gegenheimer

Answers (0)