- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2015 11:39 PM
Hello all,
Need a little help, I am trying to populate date field from another date field which adds an integer.
I have tried business rules, client scripts, calculations on the field itself and nothing seems to work.
Scenario:
I have a set DateFieldA, an IntegerField with values 30, 60, 90 and an empty DateFieldB.
DateFieldB must be the result of DateFieldA minus IntegerField.
The only Business rule that works halfway is the below, however it also changes the date on the DateFieldA (which shouldn't) so at the end, DateFieldA and DateFieldB are the same.
DateFieldA = 30.05.2015
IntegerField = 30 Days (Value is 30)
DateFieldB = should result in 30.04.2015
Halfway working BR:
- var gdt = current.DateFieldA.getGlideObject();
- var minus=current.IntegerField; //substitute your integer column names here
- minus=minus*-1;
- gdt.addDays(minus);
- gs.addInfoMessage(gdt);
- DateFieldB = gdt;
Any help will be highly appreciated!
Cheers,
Luis
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2015 02:22 AM
Let's do this in another way . You remember that yours partial working business rule was updating both of the dates . Use that kind of logic in following way
- current.DateFieldB = current.DateFieldA ;
- var gdt = current.DateFieldB.getGlideObject();
- var minus=current.IntegerField; //substitute your integer column names here
- minus=minus*-1;
- gdt.addDays(minus);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2015 02:29 AM
Worked like a charm...
Thanks!
I will now try to do this whole thread on my test instance and try to figure out why the previous BR wasnt working at all...
Thanks all again!