update short description and description in sctask

poco
Tera Contributor

i use below scrip in workflow catalog  task activity but i got  error : Fault Description: org.mozilla.javascript.WrappedException: Wrapped Conversion Error: The undefined value has no properties

please help me this 

 

 

 


 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue()  ABCDE';
task.description = 'Add the user to the abcd group';
 task.assignment_group.setDisplayValue("abcde group");
3 ACCEPTED SOLUTIONS

Aniket Chavan
Tera Sage
Tera Sage

Hello @poco ,

Give a try to the script below and see how it works for you.

// Make sure 'task' object is defined
if (task) {
  // Update short description
  task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue() + ' ABCDE';

  // Update description
  task.description = 'Add the user to the abcd group';

  // Update assignment group
  task.assignment_group = 'abcde group';
  
  // Log information
  gs.log('Task properties updated successfully.');
} else {
  // Log an error if 'task' is undefined
  gs.log('Error: Task object is undefined.');
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket

View solution in original post

Mr_m1
Tera Expert

Hi @poco 

There is an issue with below line 

 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue()  ABCDE';

try to adjust it with 
 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue()  +' ABCDE';

There is no '+' in between try to use that.

If it helps, please mark Helpful

Thanks,
Mounish.CH

View solution in original post

piyushsain
Tera Guru
Tera Guru

short description is wrong,

Try 

 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue() '+ ABCDE;

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

View solution in original post

3 REPLIES 3

Aniket Chavan
Tera Sage
Tera Sage

Hello @poco ,

Give a try to the script below and see how it works for you.

// Make sure 'task' object is defined
if (task) {
  // Update short description
  task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue() + ' ABCDE';

  // Update description
  task.description = 'Add the user to the abcd group';

  // Update assignment group
  task.assignment_group = 'abcde group';
  
  // Log information
  gs.log('Task properties updated successfully.');
} else {
  // Log an error if 'task' is undefined
  gs.log('Error: Task object is undefined.');
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket

Mr_m1
Tera Expert

Hi @poco 

There is an issue with below line 

 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue()  ABCDE';

try to adjust it with 
 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue()  +' ABCDE';

There is no '+' in between try to use that.

If it helps, please mark Helpful

Thanks,
Mounish.CH

piyushsain
Tera Guru
Tera Guru

short description is wrong,

Try 

 task.short_description = 'ABC | Add ' + ' ' + current.variables.requested_for.getDisplayValue() '+ ABCDE;

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain