Sum total value from related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 03:36 AM
Hi, I know I need to create a business rule but struggling on how as I quite new to coding.
I need to show the sum of hours on our time cards in the state of submitted but have this show on our contract table.
Can anyone help me out with script or point me in the right direction it would be greatly appreciated.
Thank you 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 03:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 03:45 AM
Hi thanks I know this however there a requirement for this to be populated in a field if you know how?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 03:47 AM
Hello,
You can refer below link
https://www.youtube.com/watch?v=JQ7dzAnNhqI
Thanks,
Snehal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 07:39 AM
Is this an OOB table?
here is a code example but i can make a better one if i knew the table and the fields.
Hopefully this will get you started.
var count;
var gr = new GlideRecord('INSERT TABLE NAME HERE');
// Check the choice list of this field to see what the value of the submitted option is
// It could be a numeric value or string depending on the field
// Assuming the name of the field is state and the desired value is 1
gr.addQuery('state', 1);
gr.query();
while (gr.next()) {
// Depending on the field hopefully this is an integer field
count += parseInt(gr.hours.toString());
}
// Here your count is stored now
gs.log('My count: ' + count);