- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2016 09:18 PM
Hi Guys ,
I have scenario as below,
We have a "date field"(u_date) in "Table A". And we have "month field"(u_month)(number of months to be added field. Its a integer field) in "Table B"
So the query is
Table B fields 'slt_id' and 'ma_id' is matching with Table A fields 'serv_id' and 'cont_id'
Note: The Table A and Table B Fields are reference fields
then it has to add the number of months from 'Table B' month field to date date field from table A and store the result in 'result_d' field.
Can someone help me to resolve this issue?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 01:07 AM
Hi
I'm not sure when you want to trigger the calculation (my guess is a business rule). The calculation is done with a glidedatatime object. Something like this
var month = [month field from table b];
var date = [date field from table a];
var gdt = new GlideDateTime(date);
gdt.addMonths(month);
date = gdt; //Update the date field on table a with this value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 01:07 AM
Hi
I'm not sure when you want to trigger the calculation (my guess is a business rule). The calculation is done with a glidedatatime object. Something like this
var month = [month field from table b];
var date = [date field from table a];
var gdt = new GlideDateTime(date);
gdt.addMonths(month);
date = gdt; //Update the date field on table a with this value