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

how do I get the sys id of the task created by a "Catalog Task Activity" in a workflow?

patricklatella
Mega Sage

Hi gang,

I've got a workflow for an application request catalog item, and in that I'm using a "Catalog Task" activity to create a task.  I need to have a 2nd activity later in the workflow reference that created task to either close it, or assign it.  To further explain, I'm using orchestration to add a user to an AD group, but I want to have a task record created so that we can track the number of requested items.  So I want the task to be created (but not assigned), and then if the "Add user to group" orchestration activity is successful, I want to close that task.  But if the orchestration activity is unsuccessful, then I want to be able to set the assignment group.

To do so, when the task is created in the activity, how can I grab the sys_id of the created task record and write it to the scratchpad?

or is there another way to reference a task created with a workflow, later in the workflow?

thanks!

1 ACCEPTED SOLUTION

think I figured it out...this worked for grabbing the sys_id of the task created by the Catalog Task activity.

workflow.scratchpad.taskid = task.setNewGuid();

View solution in original post

11 REPLIES 11

You bet! Also do not forget to mark my response as correct when you are done 🙂

Hi Abhinay,

so that's not working.  Here's my script in the Catalog Task activity, and then you'll I'm writing to the log to check it...but then see the log entry...it's not capturing the task.number. Am I doing something wrong?

 

think I figured it out...this worked for grabbing the sys_id of the task created by the Catalog Task activity.

workflow.scratchpad.taskid = task.setNewGuid();

Hi Abhinay, thanks again for your help, my last post had the working solution.  If you'd like to reply with that I'll mark your answer correct.

No worries! You can mark your answer as correct. I am still wondering why it did not work. Is this property "glide.itil.assign.number.on.insert" true in your instance?