Creating Task Definition using script

Hi all

I am trying to write a testDefinition using debug page

But this is not generating the task correctly and the options for attributes do not display in the UI

Below is my code

    TaskDefinition task = new TaskDefinition();
    task.setName("Pwc" + app.getName() + " Account Aggregation");
    task.setType(Type.AccountAggregation);
    
    //task.setArguments();
    task.setArgument("checkDeleted", "true");	
    task.setArgument("correlateOnly", "true");	
    task.setArgument("promoteManagedAttributes", "true");	
 
    task.setArgument("applications", app.getName());
    
    
    context.saveObject(task);
    context.commitTransaction();

And this is how it looks in the UI

Has anyone tried it using script and correctly created a task

Updated the code a bit to add attributes

Identity id = context.getObjectByName(Identity.class, “spadmin”);
TaskDefinition task = new TaskDefinition();
task.setName(“Pwc” + app.getName() + " Account Aggregation");
task.setType(Type.AccountAggregation);

    task.setOwner(id);
    Attributes attribute = new Attributes();  


    attribute.put("promoteAttributes", true);
    attribute.put("correlateEntitlements", true);
    attribute.put("refreshIdentityEntitlements", true);
    attribute.put("noResetNeedsRefresh", true);

    task.setArguments(attribute);

But still the UI shows the same value

Has anyone faced similar issue

Hi @mgupta403,

You must set the owner and the parent on task. For account aggregation task the parent is the taskDefinition called Account Aggregation.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.