Call An Activity From Java Script

I have requirement to call an activity through java script .Could you please help me with that.

Hi @HarikaU9,

Please use the below code:

HashStringMapactivityKeys = new HashStringMap();

activityKeys.putString(“pxObjClass”, “Rule-Obj-Activity”);

activityKeys.putString(“pyClassName”, workclass);

activityKeys.putString(“pyActivityName”, “HistoryAndAttachments” );

tools.doActivity(activityKeys , workpage, tools.getParameterPage() );

Or you can use osafeURL to call an activity

Regards,

Prasad.

@prasadreddyM16651450

Please find the snippet

<script>

```
var options = {
                name: “activityName ",
                parameters: [{name: "param1", value: "Page1.prop1", isProperty: true},  
                {name: "param2", value: 123, isProperty: false}],
                contextPage: "page1.page2 ",
                event: eventObject
            };

            pega.api.ui.actions.runActivity(options);
```

</script>