Solved

Set the core actions and connectors to ‘checked’ in Nintex Administration Action Settings page.

  • 7 October 2021
  • 1 reply
  • 10 views

I have a question regarding Nintex Administration Page, we are wanting to deploy Nintex for SharePoint and have all the Core Actions and Connectors selected by default:

 

20002i514C477000275E93.png

 

 

We are wanting to do this via a PowerShell script using the Nintex Assemblies, for example:

 

$WebApplication = Get-SPWebApplication https://blah

$SPWeb = Get-SPWeb  ‘https://blah’

$SPSite = Get-SPSite ‘https://blah’

[Nintex.Workflow.Administration.AuthorisedTypes]::InstallAuthorizedWorkflowTypes($WebApplication)

 

 

foreach ($Activity in [Nintex.Workflow.ActivityReferenceCollection]::GetAllActivities())

{

    if([string]::IsNullOrEmpty($Activity.ActivityType) -eq $false)

    {

        Write-Output "Activating $($Activity.Name)"

        Write-Output "$($Activity.ActivityId)"

    

       

        $TypeName = [String]::Empty

        $NamespaceName = [String]::Empty

        #[Nintex.Workflow.Common.Utility]::ExtractNamespaceAndClassName($Activity.ActivityType, [ref]$TypeName, [ref]$NamespaceName)

        #[Nintex.Workflow.Administration.AuthorisedTypes]::InstallAuthorizedWorkflowTypes($WebApplication, $Activity.ActivityAssembly, $NamespaceName,$TypeName);

    }

}

 

#[Nintex.Workflow.Administration.AuthorisedTypes]::RegisterWorkflowService($WebApplication,$([Nintex.Workflow.Activities.Services.WorkflowInstanceService]).UnderlyingSystemType);

#[Nintex.Workflow.Administration.AuthorisedTypes]::RegisterWorkflowService($WebApplication,$([Nintex.Workflow.Activities.Services.ReadWriteWorkflowVariablesService]).UnderlyingSystemType);

 

We can set the activities to enabled, but it doesn’t set the checkboxes.

 

The issue I am facing is that I cannot find an exposed call/method in the Assemblies to directly set an Activity to ‘Allowed’ so when I manually check an activity, I can see that the call to GetAllowActivites:

 

[Nintex.Workflow.ActivityReferenceCollection]::GetAllowedActivities($SPWeb,$SPSite))

 

The call above does return the correct activities that have been checked manually. So I am assuming if I can set the activity to ‘Allowed’ this will fix my issue?

 

To recap I would like to set the core actions and connectors to ‘checked’ in Nintex Administration Action Settings page.

icon

Best answer by DinoForbes 7 October 2021, 06:06

View original

1 reply

For anyone interested I was able to look at the aspx code and when the checkboxchange event is called, it executes: 


 


new ActivityActivationReference(activityID, siteID, webID).AddOrUpdateActivationReference();


 


So the Powershell Equivalent was all that was needed:


[Nintex.Workflow.ActivityActivationReference]::New([int]$Activity.ActivityId, [guid]::Empty, [guid]::Empty).AddOrUpdateActivationReference()


 


The trick for me was it Web and Site ID's needed to be Guid Empty so that it would run at the Farm level I believe.

Reply