The CreatorCon Call for Content is officially open! Get started here.

How to set short description for catalog task for the selected job function?

Siva P
Tera Expert

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.

1 ACCEPTED SOLUTION

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);

View solution in original post

21 REPLIES 21

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

 

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

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;

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

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

Thanks Ankur for the immediate response. But it's not working for me...below is the complete requirement from my customer. I have a two custom fileds field1 and field 2 on my sc task form .these fields will be visible only one sc task not all sc tasks. When ever user updates the values in these fields work notes should cpature the old value. I have written BR on insert and update Field 1 and field 2 changes But it's not working ..... please help me to solve this

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

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