Business rule to set field with Month/Year from date field

swnewton
Kilo Guru

I want to use a business rule to get the Month and Date from a Date field, and then populate a string field with those values.   Both fields are on the same table (time_card).

Thanks for the help!

25 REPLIES 25

Thanks guys -- not sure what is going wrong here, but no data is populating in my u_monthyear field.   I've tried both codes you've sent.   I feel like I'm overlooking something obvious.


The code I gave you should go in a business rule. Can you post the screenshot of the business rule


On Insert and Update


find_real_file.png


A minor correction. Use this code



var gdt= new GlideDateTime(current.u_datetimeoccurance.getDisplayValue());


current.u_monthyear=gdt.getMonthLocalTime()+' '+gdt.getYearLocalTime();


Thanks Skip -- that worked for me!