- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2018 12:40 PM
Hello,
I'm creating some standard change templates and we want the text field "Description" to autofill the current Month when the standard change template is chosen.
For example:
Description: Patching for the month of {javascript:get.CurrentMonth}
The code above is obviously wrong as it's an example, but is there a script that can be put in there to get to pull the current month and read "September"?
Or is this something that can only be done through a business rule. If so, how would you go about coding the rule?
Thanks,
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2018 01:19 PM
You have to change the variable name. Replace this line
current.u_hold_size = 'Patching for the month of '+str;
with
current.description = 'Patching for the month of '+str;
Please mark this post as helpful or the correct answer to your question if applicable.
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2018 12:57 PM
Use a Before BR, insert & update - Checked
when to run : Condition based on your requirement.
Advanced:
(function executeRule(current, previous /*null when async*/) {
var gd = new GlideDate();
var str= gd.getByFormat("MMMM");
current.u_hold_size = 'Patching for the month of '+str;
})(current, previous);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2018 01:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2018 01:19 PM
You have to change the variable name. Replace this line
current.u_hold_size = 'Patching for the month of '+str;
with
current.description = 'Patching for the month of '+str;
Please mark this post as helpful or the correct answer to your question if applicable.
Please mark my response as correct and helpful if it helped solved your question.
-Thanks