Skip to Content

Studio: Modify Customer.CurrentEmployeeResponsible

Hi,

I'm trying to implement a logic in the studio that allows me to set the employee responsible of a Customer.

However, Customer.CurrentEmployeeResponsible is a 1:n association (which is odd as there should only be 1 employee responsible at a time). Also, the CurrentEmployeeResponsible provides a delete method, but no Add or Create method.

Can anybody tell me how I can modify the Customer.CurrentEmployeeResponsible?

Thanks a lot!

Stefan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 31, 2017 at 02:24 PM

    Hi,

    I am checking in Root-BeforeSave event and i can see that if my CurrentEmployeeResponsible node is set then I have the option to "ADD" a new Employee with proper role code or else if CurrentEmployeeResponsible is not set then I have a option to "CREATE()" as well and then i can add employee. Please refer the attached snapshots from PDI.

    Coming to Association Cardinality being 1:n, Actually this association is not only holding the Owner Information but it also holds the information which is added in "Account Team" tab in Account based on Different roles like (Owner, Team Member, Contact etc . )

    So to change the current employee responsible you can write some code in Event-BeforeSave and replace the Employee ID in case Party Role Code is 142.

    Hope it clarify your query.

    Thanks

    Saurabh

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 01, 2017 at 02:21 PM

    Hi Saurabh,

    thanks a lot for the clarification. It works exactly like you describe. Instead of doing:

    this.CurrentEmployeeResponsible.Add()

    I have to do:

    var empres;
    empres = this.CurrentEmployeeResponsible;
    empres.Add();

    Also, in order to change one of the employees, I can just do a:

    var empres;
    empres = this.CurrentEmployeeResponsible.GetFirst();
    empres.EmployeeUUID = <new value>;
    

    It wasn't clear to me that the assignment keeps the reference to the CurrentEmployeeResponsible. I thought the GetFirst() would only give me an instance of the actual employee (so in a sense I would be modifying that employee's details).

    Thanks for your help
    Stefan

    Add comment
    10|10000 characters needed characters exceeded