How to set short description on Request Item that includes a variable

sandyml
Kilo Expert

Hi Everyone,

We have a request / workflow set up. We a variable on the Request Item & Catalog Tasks call user.

We want to dynamically update the short description of the Request Item based on the value in the user variable.

I've tried adding the following code to first catalog task (this is the point in the workflow where the user variable gets filled out): current.short_description = "MiWorkspace Onboarding for " + current.variables.user;

No luck.. however if I hardcode "Test" instead of putting current.variables.user, the short description is updated so I am not sure why it is behaving this way.

Also added a business rule in case that is necessary:

"After', Insert/Update, (but we tried both before and after)

var item = new GlideRecord('sc_req_item');

item.get(current.request_item.sys_id);

item.assignment_group = current.assignment_group;

item.update();


Does anyone have any ideas of what we can do??

thanks!

10 REPLIES 10

postwick
Giga Expert

Are you sure user is the name of the Variable?   I've found in my system that it does not lowercase them all, and it IS case sensitive.   So if I have the Question as "User" then the variable would be current.variables.User


Hi, Thanks. Yes I have verified the variable name is "user". So I don't think that is the issue. I am really confused why this is happening. Do you think a business rule needs to be added as well?


Ken83
Mega Guru

current.variables.variableName is the correct syntax to use to capture the value of the variables. Like Paul Ostwicksuggested, I would verify that you have the correct variable names.


Uncle Rob
Kilo Patron

I've tried adding the following code to first catalog task (this is the point in the workflow where the user variable gets filled out): current.short_description = "MiWorkspace Onboarding for " + current.variables.user;



Where did you add the code?   If its in the activity that creates the task in the workflow, then you probably want task.short_description and not current.short_description.   In a catalog item workflow, current = Request Item while task. = whatever task you're creating in that particular activity.