on 2020 Jul 07 6:11 AM
Dear Expert,
we have requirement to default login user as owner and login user primary sales org to sales organization in the account create page .
we have written custom logic in customer xbo Root Node - Event AfterModify to determine owner and sales organization from login user. our custom logic is executed in back end when creating new account , but value is not displaying in the UI, while saving the account only the value is displaying in the UI.
The custom logic is written in Customer XBO Root Node – AfterModify event.
Code:
var identity = Identity.Retrieve(Context.GetCurrentIdentityUUID());
var employee = BusinessObject::Employee.Retrieve(identity.BusinessPartnerUUID);
var EmployeeResponsible = this.EmployeeResponsibleSales;
if(!EmployeeResponsible.IsSet())
{
var employeeRes : elementsof Customer.CurrentEmployeeResponsible;
employeeRes.PartyRoleCode = "142";
employeeRes.EmployeeUUID = employee.UUID;
employeeRes.DefaultIndicator = true;
this.CurrentEmployeeResponsible.Create(employeeRes);
}
if(this.SalesArrangement.Count() == 0)
{
var salsorgAssign = employee.OrganisationalUnitAssignment;
foreach(var orgunit in salsorgAssign)
{
if(orgunit.RoleCode == "219")
{
var Assignsalesorg = SalesArrangement.Create();
Assignsalesorg.CustomerUUID = this.UUID;
Assignsalesorg.SalesOrganisationUUID = orgunit.ToRoot.UUID;
if(orgunit.ToRoot.DistributionChannelAndDivision.GetFirst().IsSet())
{
Assignsalesorg.DistributionChannelCode = orgunit.ToRoot.DistributionChannelAndDivision.GetFirst().DistributionChannelCode;
Assignsalesorg.DivisionCode = orgunit.ToRoot.DistributionChannelAndDivision.GetFirst().DivisionCode;
}
}
}
}
When clicking new button our custom code is executed but value is not displayed in the UI, when saving the account only its displaying the value.
By,
Jeyakumar
Request clarification before answering.
Hi jeyakumar.asai,
I would suggest to use workflow to set a default owner:
2506111 - Assign the Logged on User as the Account Owner When Creating an Account
Regarding Sales Area Determination please check if the following blog answers your needs:
Automatic Sales Area Determination during Account Creation – New 1911 enhancement
Regards,
Bartosz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.