- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2020 02:02 AM
Hi ,
I have catalog item with the filed called request type, it is a choice field we have multiple choices. When user selects some of the choices from the dropdown and clicks order now . Then it will create a RITM and attached with catalog task.
Now i need set the catalog task short description field with some text based on the selected choice for catalog item filed.
Please help me how to achieve this. Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 07:50 PM
Hi Ankur,
I have given filter condition like below but the values which are not storing in worknotes.
Script:
var str = '';
if(current.u_actual_effort != '')
str = str + previous.u_actual_effort + ' ';
if(current.u_week_and_month != '')
str = str + previous.u_week_and_month;
current.work_notes = str;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2020 09:49 AM
Hi Sambasiva,
So I assume you know the value of custom field during task creation so you can use the catalog task activity here
updated script below:
var value = current.variables.<variableName>;
switch(value) {
case "abc": task.short_description = ''; // specific description
case "def": task.short_description = ''; // specific description
case "xyz": task.short_description = ''; // specific description
}
task.work_notes = custom field value here;
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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2020 03:22 AM
Hi Ankur,
i don't have any variables on sc task. I have field called duration of week. When task moved to next week but still it is work in progress then the duration will auto update on that field . At this time i need to store the previous week value in worknotes for that particular task.
I have used your script on my catalog task activity. could you please suggest me if i am wrong?
var value = current.variables.u_duration;
switch(value) {
case "abc": task.short_description = 'test task'; // specific description
}
task.work_notes = u_duration;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 02:40 AM
Hi,
during task creation this field would be empty
So it won't make sense populating it from Catalog Task Activity
you need to write schedule job which runs weekly and checks if task still open; if yes then update the work notes with the duration
1) job queries sc_task for RITMs belonging to particular Item && Task open
2) update the field
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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 09:57 AM
Hi,
So using BR you need to handle
You need some unique field value such as short description to identify that particular task
BR: Before Update
Condition: Field 1 or Field 2 changes && current.short_description == 'Task 1'
Sample Script below
var str = '';
if(current.<field1> != '')
str = str + previous.<field1> + ' ';
if(current.<field2> != '')
str = str + previous.<field2>;
current.work_notes = str;
It would look like if field 1 is having hello and field 2 is having abc
hello abc
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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader