Set task short description dynamically via business rule

Amelie G
Kilo Expert

Hi all,

I need to set the short description of the tasks created via a certain catalog item to be the catalog item name + a variable (user's name). I know this can be done in the workflow but I don't want to make any changes there as it's being used with all the catalog items. I've created a before insert business rule with the condition:

current.cat_item == gs.getProperty('new.joiner')

And the script is:

(function executeRule(current, previous /*null when async*/ ) {

  sc_task.short_description = current.cat_item.name + current.variables.joiner_name;

})(current, previous);

But it doesn't work. Currently, the short description of the tasks is set to something else and I can't figure out where this is configured - I've checked the workflow, the dictionary, catalog client scripts, business rules. So my business rule either doesn't work, or is overriden by the current config. Any ideas on how to solve this?

Thanks

1 ACCEPTED SOLUTION

Try to use below code

Condition should be

current.request_item.cat_item == gs.getProperty('new.joiner')
(function executeRule(current, previous /*null when async*/ ) {

  current.short_description = current.request_item.cat_item.name + current.request_item.variables.joiner_name;

})(current, previous);

Thanks and Regards,

Saurabh Gupta

View solution in original post

5 REPLIES 5

Saurabh Gupta
Kilo Patron
Kilo Patron

Can you tell on which table you have written the BR?


Thanks and Regards,

Saurabh Gupta

Hi Saurabh, it's on sc_task table. Should it be on sc_req_item? I didn't consider this.

Try to use below code

Condition should be

current.request_item.cat_item == gs.getProperty('new.joiner')
(function executeRule(current, previous /*null when async*/ ) {

  current.short_description = current.request_item.cat_item.name + current.request_item.variables.joiner_name;

})(current, previous);

Thanks and Regards,

Saurabh Gupta

Amazing, thank you for this! It makes sense why mine wasn't working 🙂