Is it possible to clone a workflow activity definition with all activity variables

pkottam
Kilo Contributor

Hello,

 

I am trying to clone a workflow activity definition "Create Task" with all activity variables. I am able to clone the workflow activity Definition without any activity variables using Insert. Is there a way to clone a workflow activity definition "Create Task" with all activity variables?

17 REPLIES 17

restevao, did you encounter any errors after using this UI action to clone the Approval - Group workflow activity? I have done the same and am receiving errors indicating 

invalid Activity Definition for [custom copy name]

chitra11
Tera Contributor

Hi jeff, i am also getting same error. did u resolved it?

Hi Chitra.

I wasn't able to resolve the issue with cloning the Approval - Group workflow activity. However, I did find an alternative solution to the original issue of the activity deleting previous group approval records. 

@Daniel C. Oderbolz provided the basis for the alternative solution. It consists of adding a Run Script activity after the Approval - Group activity to clear wf_activity value from the approval record. Clearing this value prevents the OOB logic in the Approval - Group activity definition from identifying previous group approval records which in turn avoids them getting deleted. I had to make a small change to Daniel's script to get it working for me. Here is the solution that is working in my environment.

Good luck ????

// Make sure wf_activity of the last approval is removed to avoid the deletion of the record
var sysid_current = current.sys_id.toString();

var grApproval = new GlideRecord('sysapproval_approver');
grApproval.addEncodedQuery('state=approved^wf_activity!=NULL^sysapproval=' + sysid_current );
grApproval.query();

while (grApproval.next())
{
    grApproval.setValue('wf_activity','');
    grApproval.setWorkflow(false);
	grApproval.update();
}

// Also make sure wf_activity of the last group approval record is removed to avoid the deletion of the record
var grGroupApproval = new GlideRecord('sysapproval_group');
grGroupApproval.addEncodedQuery('approval=approved^wf_activity!=NULL^parent=' + sysid_current );
grGroupApproval.query();

while (grGroupApproval.next())
{
    grGroupApproval.setValue('wf_activity','');
    grGroupApproval.setWorkflow(false);
	grGroupApproval.update();
}