- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:48 AM
Wont that get me the month as a number? I need it as a string
ex: not 04, but instead as 'April'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 10:06 AM
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
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:39 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:41 AM
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