Skip to Content
0
Jul 07, 2020 at 05:11 AM

Defaulting owner and sales organization in new account create page in C4C

352 Views Last edit Jul 13, 2020 at 12:11 PM 3 rev

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