Background
I have a custom activity that I developed a year ago for a site in SharePoint 2010. The custom activity calls a string method which contains three strings parameters.
Here is the relevant part of the .ACTIONS file:
<RuleDesigner Sentence="Search by %1 of profile ID %2 of Type %3 result %4 ">
<FieldBind Field="Cedula" Text="cedulaUsuario" Id="1" DesignerType="TextArea"/>
<FieldBind Field="Perfil" Text="idPerfil" Id="2" DesignerType="TextArea"/>
<FieldBind Field="TipoAsignacion" Text="tipoAsignacion" Id="3" DesignerType="TextArea"/>
<FieldBind Field="TxtError" Text="txtError" Id="4" DesignerType="ParameterNames"/>
</RuleDesigner>
<Parameters>
<Parameter Name="Cedula" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="Perfil" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="TipoAsignacion" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="TxtError" Type="System.String, mscorlib" Direction="Out"/>
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" />
</Parameters>
The logic of the custom activity basically makes CRUD operations in a SQL database; this is not the problem yet, the main problem is the execution of the custom activity itself.
Current problems
For an unknown reason, this specific custom activity doesn't work anymore, so, I have to create a new workflow with the custom activity added on it using SharePoint Designer (for testing); but when I tried to publish, I received this error:
Errors where found when compiling the workflow. The workflow files were saved but cannot be run.
In the advanced section appear:
Unexpected error on server associating the workflow
I found on internet1 that this error occurs because the Temp folder is missing, and it was right. I have to create the Temp folder at C:\Users\<install>\AppData\Local\
location and inside the Temp folder, create a read-only text file (.txt).
After this change, another problem ocurrs:
Checking the SharePoint logs, it appears that the TxtError
output parameter isn't generated. Instead a TxtErrorFlow
appears in the log files:
0x1DEC SharePoint Foundation Legacy Workflow Infrastructure 72fs Unexpected RunWorkflow: Microsoft.SharePoint.SPException: <Error><CompilerError Line="93" Column="123" Text="Could not find property or event 'TxtErrorFlow' on type 'Glogic.AsignaciondeElementos.Code.AsignacionCode'." /></Error> at Microsoft.SharePoint.Workflow.SPNoCodeXomlCompiler.LoadXomlAssembly(SPWorkflowAssociation association, SPWeb web) at Microsoft.SharePoint.Workflow.SPWinOeHostServices.LoadDeclarativeAssembly(SPWorkflowAssociation association, Boolean fallback) at Microsoft.SharePoint.Workflow.SPWinOeHostServices.CreateInstance(SPWorkflow workflow) at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut) at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflowElev(SPWorkflow w... f9ef5d9d-fa5f-c053-5312-d7978deecd95
I renamed the TxtError
variable after bad copy/paste sample code from another current functional custom activity.
After made the following changes:
- Rename and rewrite manually the
TxtError
variable in theFieldBind
andParameter
tags in the .ACTIONS file. - Clean, Build and Deploy in Visual Studio 2012.
- Update .wsp file using PoweShell command.
- Execute
iisreset
command. - Clear SPD cache of my PC.
Appears the following error in the SharePoint logs:
System.NullReferenceException: Object reference not set to an instance of an object. at Glogic.AsignaciondeElementos.Code.AsignacionCode.get_TxtError() at Glogic.AsignaciondeElementos.Code.AsignacionCode.AsignarElementosAlUsuario(String cedulaUsuario, String idPerfil, String tipoAsignacion) at Glogic.AsignaciondeElementos.Code.AsignacionCode.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()
(Both errors occurs when the workflow is manually activated).
Each publish
event made, deletes temporal files at quoted location at previous lines. I really don't know what else I can do for solve that custom activity renders/build correctly and useful again.
I have found several similar questions on internet, but the get_TxtError() shown in the SharePoint logs continues.
1 I couldn't get the original link source, but the described steps are the relevant part of the source.