Short Description Field Auto Filling!

locke1
Kilo Contributor

Alright, this is a wee bit complicated, but I'll try to explain as clearly as I can!

The problem:

We go to our Service Catalog under the Self Service module.

We open an item called "AR Recoveries Request". This is a typical service request form.

Items on the request form include the "Requested By", "Requested For", "Deadline", "Long Description", and "Relevant Contract" fields. Notice the lack of a "Short Description" field.

A user fills out these fields and clicks "Order Now".

A Request (REQ) is created. Inside the Request is a Requested Item (RITM). Inside the Requested Item is a Catalog Task (SCTSK). So in here lies the problem.

The "Short Description" field inside of the Catalog Task is defaulting to "Service Request - AR Recoveries Request". This is true although a short description is never asked for during the entire request creation process.

What we need:

1.) We need this field to stop defaulting to "Service Request - AR Recoveries Request".

2.) We need this field to display the information that is entered into a "Short Description" field on the "AR Recoveries Request" form. You see where I previously mentioned the lack of a "Short Description" field on the "AR Recoveries Request" form? We plan to add one there that we would like to sync with the "Short Description" field on the Catalog Task page.

Hopefully that was somewhat clear!

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Then in the existing task activity code, you can add a check. Something like this should do



if(current.cat_item.getDisplayValue()=="your specific item name"){


task.short_description=current.variables.<short description variable name>;


}


else{


task.short_description = "Service Request - " + current.cat_item.getDisplayValue();


}


View solution in original post

28 REPLIES 28

vaibhavshinde
Kilo Expert

I can suggest two options:



1.Complex Option - Create a workflow on task, can add run script which will pull the value of variable and update the short description field.


2. Simple Option - Instead of using OOB 'Create Task' workflow activity, use 'Run Script' activity to create task. So that your script can set the automatically change the short description. Let me know if you need the code for this.


The simple option would be preferred. May I see that code?


I believe you are creating tasks from the workflow. If so, in the existing create task activity, use this line in the advanced script section


task.short_description=current.variables.<short description variable name>;


Your task creation script of run script activity should be like:




var task = new GlideRecord('sc_task');


  task.initialize();


  task.short_description=current.variables.<short description variable name>;


  task.description="Write description here";


  task.request_for=current.request_for;


  task.request_item=current.sys_id;


  task.request=current.request;


  task.assignment_group="sys_id of the group you have to select";


  task.insert();



Get value of short description variable and when it match with any choice create the task accordingly.


N.B. as variable is list collector type, it will return sys_id.




Please mark it as Helpful/Correct according to its impact.