How to call an Activity from JavaScript?

Calling activity through javascript ?

@MonikaS9010 Please use these methods to call activity.

HashStringMapactivityKeys = new HashStringMap();
activityKeys.putString(“pxObjClass”, “Rule-Obj-Activity”);
activityKeys.putString(“pyClassName”, workclass);
activityKeys.putString(“pyActivityName”, “HistoryAndAttachments” );
tools.doActivity(activityKeys , workpage, tools.getParameterPage() );

@MonikaS9010 - We can make use of Pega javascript api’s.

<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>

Thank you.

Hi @MonikaS9010,

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