Hello ,
I have 3 custom entity Employee, Salary Master and Salary Breakup.
Salary breakup has lookup to Salary Master and employee
Salary maters has 1 option filed Payout Type and 1 text filed Name
Option filed has 2 value earning and deduction
I have created 4 records in salary master
Basic - Earning
Pf - deduction,
hra - Earning
travel allowance - Earning
I want on creation on employee salary breakup shroud generate 4 (no of record in salary master)
Employee1 -Basic -Earning
Employee1 -Pf -deduction
Employee1 -hra -Earning
Employee1 - travel allowance - Earning
I have written following code but getting error. Please help me with this.
Entity objmastersalary = (Entity)service.Retrieve("new_salarymaster", context.PrimaryEntityId, new ColumnSet(true));
Entity SalaryBreakup = new Entity("new_salarybreakup");
QueryExpression QueryMasterSalary = new QueryExpression("new_salarymaster");
QueryMasterSalary.ColumnSet = new ColumnSet(true);
EntityCollection Collecmastersalary = service.RetrieveMultiple(QueryMasterSalary);
if (Collecmastersalary.Entities.Count > 0)
{
foreach (Entity mastersalary in Collecmastersalary.Entities)
{
SalaryBreakup.Attributes["new_salarymaster"] = new EntityReference("new_salarymaster", context.PrimaryEntityId);
service.Create(SalaryBreakup);
}
}
*This post is locked for comments