Setting Template Field Value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2018 08:35 AM
Hi,
I need to setting defalut value for the template field whenever a new template is created.
I create after update business rule.
(function executeRule(current, previous /*null when async*/) {
if(current.isNewRecord() && current.table=='incident')
current.template('u_template_name_used',current.name);
})(current,previous);
This doesnt to set the value after i submit the new template.And also i want the fields to remain set which i have already choose for templae field.
Please help.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 02:46 AM
You need to modify "template" field value with proper syntax. In your code, you are calling "template" method on GlideRecord object with two parameters but such methods most probably does not exist. So to set template field value to new value you should do assignment like:
current.template = 'your_field_name=Your Field Value^' + current.template;
I put your fix value at the beginning of the template value and append to it the current value so that it is not lost.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 02:52 AM
Thanks!!
and i also want the fields to remain set which i have choose while creation. I guess accordng to this , this will vanish off all the already chosen field and set this field.
how to proceed with that. what statement i need to included?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 02:57 AM
No, since I am putting together the fixed value and current.template, nothing will be lost and fixed value and values entered during the creation will be stored newly in the template.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2018 04:03 AM
current.template = 'u_template_name_used=current.name^' + current.template;
it will not fetch the cuurent.name value..it takes it as string.
i have tried using +current.name but that doesnt work