Wont that get me the month as a number? I need it as a string 

ex: not 04, but instead as 'April'

Hi JJG

Have you tried this? 

this line code giving month as "April" instead of "04".

Exactly what do you want?

 

 

Look at this

find_real_file.png

Hi,

use this in the before insert BR

var year = new GlideDateTime().getYear();

var gd = new GlideDate();

var monthName = gd.getByFormat("MMMM");

current.<string_field> = monthName + ' - ' + year;

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Mark Roethof
Tera Patron

Hi JJG,

This is scoped right if I remember most of your other questions?

If so, the solution of Vaibhav will work fine. Only the gs.print will not work, be aware of that.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Jaspal Singh
Mega Patron

Hi,

 

No need of Business rule you can pass the default value for the field to be something as below.

javascript:var gdt = new GlideDateTime().getDate();gdt.getByFormat('MMM - YYYY');

 

Thanks,

Jaspal Singh