none
Regarding the Custom workflowContext is comming null

    Question

  • Hi,

    I am new in VS2010 workflow for sharepoint 2010.

    I am using CreateItemActivity where i created the properties and when i am try to use the context on Execute(ActivityExecutionContext executionContext) method so i am getting Workflow Context to null.

    So please suggest me why i am getting it.

    With Regards

    Akhilesh Rao


    • Edited by Akhilesh Rao Monday, September 05, 2011 2:25 AM sentence formation
    Monday, September 05, 2011 2:12 AM

Answers

All replies

  • Hi Akhilesh,

    Before you use CreateItemActivity, you should add ApplyActivation first, and get the workflow context in this activity, then use it in CreateItemActivity,

    For more information, please refer to:
    http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/01/18/creating-sharepoint-items-with-createitemactivity.aspx

    Thanks,
    Simon

    • Marked as answer by Akhilesh Rao Thursday, September 15, 2011 5:25 AM
    Wednesday, September 07, 2011 6:57 AM
  • hi Simon,

     

    I already seen this article but not working.

    With Regards

    Akhilesh Rao

    Monday, September 12, 2011 7:24 AM
  • Hi Akhilesh,

    I tested and it works for me. Could you please provide more information about your workflow?

    Thanks,
    Simon

    Monday, September 12, 2011 7:28 AM
  • Hi Simon,

    I create a Site level custom workflow. From the webpart it is sending the data to workflow where i am check the status and based on the status i need to create new list in a list. Then after need to send a mail to user. For createing a new list in custom list i was using CreateItemActivity. So it was not creating the list item in the SPList.

    I tried your link in that Context used to come null. that was the problem

    Please suggest me where i can get details practical information about the sharepoint Activities for VS2010.

     

    With REgards

    Akhilesh Rao 

    Monday, September 12, 2011 7:37 AM
  • Hi Akhilesh,

    I write a Demo, please refer:
    http://blog.sina.com.cn/s/blog_64800be70100yjpv.html

    Thanks,
    Simon

    • Marked as answer by Shimin Huang Thursday, September 15, 2011 3:37 AM
    Tuesday, September 13, 2011 5:31 AM
  • Hi Simon,

    it is not working here. I am excutingthe this work flow on sharepoint 2010 Foundation. I followed the same steps what u have shown on the site.

    Can you please share your demo file on "rao.akhilesh@gmail.com"?

    With REgards

    Akhilesh Rao


    • Edited by Akhilesh Rao Tuesday, September 13, 2011 7:31 AM added point.
    Tuesday, September 13, 2011 6:31 AM
  • Hi Akhilesh,

    I test it in SharePoint 2010 Foundation and it works fine. Please Provide the error message so I could do some further research.

    Thanks,
    Simon

    Tuesday, September 13, 2011 8:18 AM
  • Hi Simon,

    i checked in Logs folder and found the below this.

    09/13/2011 14:29:28.77  vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       umad Medium   Solution Deployment : Looking for 'ReceiverAssembly' attribute in manifest root node for solution 'myfirsttestsqlworkflow.wsp'. 
    09/13/2011 14:29:28.77  vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       umae Medium   Solution Deployment : Looking for 'ReceiverClass' attribute in manifest root node for solution 'myfirsttestsqlworkflow.wsp'. 
    09/13/2011 14:29:28.77  vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       umal Medium   Solution Deployment : Missing one or more of the following attributes from the root node in solution myfirsttestsqlworkflow.wsp: assembly '', type ''. 
    09/13/2011 14:29:29.01  vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       8xqz Medium   Updating SPPersistedObject SPSolution Name=myfirsttestsqlworkflow.wsp. Version: -1 Ensure: False, HashCode: 4413806, Id: 750ebe9b-d43f-4994-b45d-f7084ccc6c58, Stack:    at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()     at Microsoft.SharePoint.Administration.SPPersistedChildCollection`1.Add(T newObj, Boolean ensure)     at Microsoft.SharePoint.Administration.SPPersistedChildCollection`1.Add(T newObj)     at Microsoft.SharePoint.Administration.SPSolutionCollection.Add(String path, String name, UInt32 lcid, Boolean isRestore)     at Microsoft.SharePoint.Administration.SPSolutionCollection.Add(String path)     at Microsoft.VisualStudio.SharePoint.Commands.SolutionDeploymentManager.AddSolutionToFarm(String name, String solutionFilePath)     at Microsoft.VisualStudio.Shar... 
    09/13/2011 14:29:29.01* vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       8xqz Medium   ...ePoint.Commands.SolutionDeploymentManager.AddSolution(SolutionInfo solutionInfo)     at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     at System.Delegate.DynamicInvokeImpl(Object[] args)     at Microsoft.VisualStudio.SharePoint.Commands.SharePointCommand.Execute(SharePointCommandContext commandContext)     at Microsoft.VisualStudio.SharePoint.Commands.SharePointCommand.Execute(SharePointContext sharePointContext, CommandFlags flags, Byte[] serializedParameter, ISharePointCommandLogger logger)     a... 
    09/13/2011 14:29:29.01* vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       8xqz Medium   ...t Microsoft.VisualStudio.SharePoint.Commands.CommandManager.ExecuteCommand(SharePointContext sharePointContext, String commandId, CommandFlags flags, Byte[] messageBody)     at Microsoft.VisualStudio.SharePoint.Commands.RemoteCommandService.ExecuteCommand(String commandId, CommandFlags flags, Byte[] messageBody)   
    09/13/2011 14:29:29.12  vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       8xqz Medium   Updating SPPersistedObject SPSolutionLanguagePack Name=0. Version: -1 Ensure: False, HashCode: 29093122, Id: 7b45929b-f66e-4aa1-9d79-fedb5f80917b, Stack:    at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()     at Microsoft.SharePoint.Administration.SPSolution.AddLanguagePack(SPFarmSolutionPackage solnPackage, String path, UInt32 lcid, String name, Boolean isRestore)     at Microsoft.SharePoint.Administration.SPSolutionCollection.Add(String path, String name, UInt32 lcid, Boolean isRestore)     at Microsoft.SharePoint.Administration.SPSolutionCollection.Add(String path)     at Microsoft.VisualStudio.SharePoint.Commands.SolutionDeploymentManager.AddSolutionToFarm(String name, String solutionFilePath)     at Microsoft.VisualStudio.SharePoint.Commands.SolutionDeploymentMan... 
    09/13/2011 14:29:29.12* vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       8xqz Medium   ...ager.AddSolution(SolutionInfo solutionInfo)     at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     at System.Delegate.DynamicInvokeImpl(Object[] args)     at Microsoft.VisualStudio.SharePoint.Commands.SharePointCommand.Execute(SharePointCommandContext commandContext)     at Microsoft.VisualStudio.SharePoint.Commands.SharePointCommand.Execute(SharePointContext sharePointContext, CommandFlags flags, Byte[] serializedParameter, ISharePointCommandLogger logger)     at Microsoft.VisualStudio.SharePoint.C... 
    09/13/2011 14:29:29.12* vssphost4.exe (0x1678)                   0x183C SharePoint Foundation          Topology                       8xqz Medium   ...ommands.CommandManager.ExecuteCommand(SharePointContext sharePointContext, String commandId, CommandFlags flags, Byte[] messageBody)     at Microsoft.VisualStudio.SharePoint.Commands.RemoteCommandService.ExecuteCommand(String commandId, CommandFlags flags, Byte[] messageBody)

    Please me know if you want any thing.

    With REgards

    Akhilesh Rao

    Tuesday, September 13, 2011 9:05 AM
  • Hi Akhilesh,

    Please provide the error message you received when debug.

    Did you install the SharePoint on local server? Did you run the Visual Studio with Administrator mode?

    Thanks,
    Simon

    Tuesday, September 13, 2011 9:22 AM
  • Hi Simon,

    Yes, I run as Administrator the VS2010. i am not getting error in my code. But after executing the workflow when i check the list no item inserted and then after after i navigated to the workflow in "My Running Workflows" section it shows Error Occurred message. Once i clicked on the "Error Occurred" link then i found " 9/13/2011 3:03 PM Error System Account An error has occurred in MyFirstTestSqlWorkFlow - Workflow1. " message. It is not giving details or any code.

    With Regards

    Akhilesh Rao

    • Edited by Akhilesh Rao Tuesday, September 13, 2011 9:37 AM formate
    • Proposed as answer by Nitin J. Jain Tuesday, September 13, 2011 12:04 PM
    Tuesday, September 13, 2011 9:36 AM
  • Hi Akhilesh,

    Did you run the workflwo in Debug mode or just deploy the workflow and then run it? Did you receive the code sample I sent to you?

    Thanks,
    Simon

     

    Tuesday, September 13, 2011 10:42 AM
  • Hi Simon,

    Thanks for shareing the code.

    I will check it out on difference server then i will tell you.

    Becuase same thing i have also done but it was not working.

    With Regards

    Akhilesh Rao

    Wednesday, September 14, 2011 6:48 AM
  • Hi Simon,

     

    I have replied to your email. Please check it once. Do i need to do some settings in for it.

    With Regards

    Akhilesh Rao

    Wednesday, September 14, 2011 9:41 AM
  • Hi Akhilesh,

    I find the problem, for applyActivation1, you should not bind its _Workflowproperties to a new member named Workflowproperties1, you should bind it to the existing member of Workflowproperties.

    The uncorrect workflowproperties

    The correct workflowproperties:

     

    Thanks,
    Simon

    • Marked as answer by Shimin Huang Thursday, September 15, 2011 3:37 AM
    Thursday, September 15, 2011 3:36 AM
  • Thanks you so much Simon. It is working now.

     

    Thursday, September 15, 2011 5:24 AM
  • Hi,

    I am facing the same problem when deploying my workflow.

    No error while deploying in VS 2010 but when i navigate to the site no task is being created and an error occur in the workflow.

    I even tested the deployment of an empty State machine workflow and the error persists.

    Any help would be appreciated.

    Thank you,

     

    Tuesday, January 24, 2012 1:45 PM