cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

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

jeyakumar_asai
Discoverer
0 Likes
952

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

Accepted Solutions (0)

Answers (1)

Answers (1)

ziolkowskib
Active Contributor
0 Likes

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

jeyakumar_asai
Discoverer
0 Likes

Hi Bartosz ,

Thanks for your reply.

I have already checked this link you have shared.

This workflow rule is executed while saving account only, but our requirement is to default owner and sales organization when clicking new button .in the account.