Using the UiPath.Activities.API package from the Official feed (https://pkgs.dev.azure.com/uipath/Public.Feeds/_packaging/UiPath-Official/nuget/v3/index.json
), you can set Studio to show activities that match the custom activity's scope at search. For information on how to use the API, see About the Activities SDK.
Therefore, when clicking the icon inside a custom activity the Command Palette offers suggestions of activities which fit the current scope.
To achieve this, use the IScopedActivitiesService
interface, with the following methods:
SetScopedActivity
- Adds a pair made from a scope activity and an activity that is suitable to that scope.SetScopedActivities
- Adds a list of suitable activity types to the specified scope type.
Below is an example of how these methods should be used inside your custom activity:
public void Initialize(object argument)
{
try
{
if (!(argument is IWorkflowDesignApi api))
{
return;
}
if (api.HasFeature(DesignFeatureKeys.ScopedActivities))
{
api.ScopedActivitiesService.SetScopedActivities(typeof(FirstScopeActivity), new List<Type>() { typeof(FirstChildActivity), typeof(SecondChildActivity) });
api.ScopedActivitiesService.SetScopedActivity(typeof(SecondScopeActivity), typeof(ThirdChildActivity));
}
}
catch (Exception ex)
{
Trace.TraceError(ex.Message);
}
}
Updated 2 months ago
See Also
Scoped Activities Reference |