Copy the Short description from RITM to Short Description on SCTASK

riskay123
Mega Guru

Hello,

I have a flow where I am trying to copy the content of the Short description and description fields from the RITM to the Short description and description fields on the SCTASK in flow designer. I have been able to do this when using Workflow in previous catalog items, but it doesn't seem to work the same in Flow Designer.

This is an example of the script I us on the SCTASK on the workflow. How can I best tweak this so it will work in the SCTASK on a flow?

 

EXAMPLE SCRIPT

// Update task description with RITM short description

    // For example:

 

task.short_description = current.short_description;

    if(current.cat_item == 'ddbca057973202101329f6fce053af16')// Name Change Cat Item

        {

            task.short_description = "Review user details and confirm with user - "+current.short_description;

            task.description = current.description;

}

 

Thanks in advance for any help.

8 REPLIES 8

It lets me save it with no error but as soon as I try to activate the flow I get the same error.

Hello @riskay123 ,

To get the RITM data, we have to use fd_data.trigger.request_item.<variable name>. Try the below updated code. 

 

/*
**Access Flow/Action data using the fd_data object. Script must return a value. 
**Order number is offset by +1 in Error Handling Section.
**Available options display upon pressing "." after fd_data
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
var shortDesc = fd_data.trigger.current.short_description;
 if(fd_data.trigger.request_item.cat_item == 'ddbca057973202101329f6fce053af16'){
    shortDesc = "Review user details and confirm with user - "+shortDesc;
}
return shortDesc;

 

Thanks,

Alka

 

Can you try below code?

 

var shrt = fd_data.trigger.request_item.short_description; // gets short description of RITM

var desc = fd_data.trigger.request_item.description; // gets description of RITM

shrt = fd_data.trigger.current.short_description; //short description field on SCTASK

desc = fd_data.trigger.current.description; // description field on SCTASK

Voona Rohila
Kilo Patron
Kilo Patron

Hi @riskay123 
Do you have any flow linked to the catalog item?

If yes then you should use 'Create Catalog task' in your flow, This is similar to 'Catalog task' Activity Available on Workflow.

VoonaRohila_0-1722264811451.png

 

https://docs.servicenow.com/bundle/washingtondc-build-workflows/page/administer/flow-designer/refere...

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP