generate resource_aggregate_weekly and resource_aggregate_monthly

daikhi haithem
Tera Expert

 

 

Detailed description

Hello

 

 

I am currently encountering an issue with a specific function within a custom script for creating daily allocations. This function is intended to facilitate the insertion of new records into the resource_allocation_daily table. However, I've noticed an inconsistency based on the type of record being set.

 

 

When I execute the command newRecord.setValue('type', "project_work"); to specify the record type, I observe that new records are not being generated in the resource_aggregate_weekly and resource_aggregate_monthly tables as expected.

 

Conversely, if I use the command newRecord.setValue('type', "task_work");, it results in the generation of new records in these tables without any issues.

 

My objective is to have the function generate records in both the resource_aggregate_weekly and resource_aggregate_monthly tables when the record type is set to "project_work". Could anyone provide guidance or suggestions on how to resolve this issue?

 

 

MakeAllocationDaily: function(mandays, taskSysId, allocationDate, projectName, current) {

var newRecord = new GlideRecord('resource_allocation_daily');

newRecord.initialize();

newRecord.setValue('name', projectName);

newRecord.setValue('allocation', current.sys_id);

newRecord.setValue('notes', current.u_notes);

newRecord.setValue('date', allocationDate);

newRecord.setValue('type', "project_work");

newRecord.setValue('task', taskSysId);

newRecord.setValue('user', current.user);

newRecord.setValue('man_days', mandays);

newRecord.setValue('fte', 1);

newRecord.setValue('hours', 8);

 

newRecord.insert();

},

 

1 ACCEPTED SOLUTION

daikhi haithem
Tera Expert

I have found the problem. There is a business rule named 'Update Resource Aggregates' that checks for 'top_task' to push the type, and as for me, in my code, I don't have 'newRecord.setValue('top_task', taskSysId);' this business rule affects 'non_project_time' as the type

View solution in original post

1 REPLY 1

daikhi haithem
Tera Expert

I have found the problem. There is a business rule named 'Update Resource Aggregates' that checks for 'top_task' to push the type, and as for me, in my code, I don't have 'newRecord.setValue('top_task', taskSysId);' this business rule affects 'non_project_time' as the type