- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 12:27 PM
Hi experts,
I have this idea, could you help me for how make this?
A = (u_fecha_de_inicio) type: date
B = (u_horas_mes) type: decimal
C = Records, within of this record exist the variable = (u_horas_mm)
D = (u_horas_totales) type: decimal
well, should be created records depending of the following:
Should be created records depending on the variable B, in this case contains the number 20, so you should create records with that value in the variable (u_horas_mm),
until those values for each independent record, added all become equal to the variable D, in this case 400.
With this what it would look for is to make the records as are necessary until all a up to what it contains D.
Thanks and Regards!
CC
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 01:10 PM
If I get what you are saying, you want child records created automatically for all the total contracted hours. For example, your company contracted us for 400 hours at 20 hours per month?
after insert of the parent service contract:
var hours = current.u_horas_totales;
var hpm = current.u_horas_mes;
var count = hours/hpm;
for(i=0; i<count;i++){
var child = new GlideRecord('child_table');
child.contrato = current.sys_id;
child.insert();
}
That would create 20 blank records all relating to the parent contract. You can add info as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 01:10 PM
If I get what you are saying, you want child records created automatically for all the total contracted hours. For example, your company contracted us for 400 hours at 20 hours per month?
after insert of the parent service contract:
var hours = current.u_horas_totales;
var hpm = current.u_horas_mes;
var count = hours/hpm;
for(i=0; i<count;i++){
var child = new GlideRecord('child_table');
child.contrato = current.sys_id;
child.insert();
}
That would create 20 blank records all relating to the parent contract. You can add info as needed.