SharePoint Designer 2013 workflow - creating new items in the list

Hi,
I need to create a workflow in SharePoint designer 2013. Basically the flow is like that:
There is a Request List where people submit their requests. The requests have status: Submitted and Completed.
Once the status goes to 'Completed" there should be a workflow triggered that creates an entry in another list; VoC list and populate VoC columns. Additionally there should be an email send to the requestor that the request has been processed.
I tried to do that but I failed - what do I do wrong? It keeps telling me that there is an error in workflow.
Could you, please help me? Thank you.
Thank you.
Kind regards,
Jowita

With this command it populated the Voc list. But when I tried to add additional fields, the workflow did not work. Fo example, I've got a column "Requestors Name" in Request List and I would like the same column in Voc List to be automatically
populated with the data from Requestors List. I set Field Requestors name to Value Current item:Requestors name but it did not work :-(
What do you mean by "VoC column is already created in VoC list"?
And one additional question: is it possible for the workflow to automatuically create new columns in the VoC list?
Hi Jowita,
We could use workflow to populate values in column but not populate new columns, so the column should be created in list manually before workflow.
As I understand now, you need to use workflow to populate at least two columns in another list, and one is person or people type. I captured a screenshot for your reference, pp column is in person or group type in both two lists, please set return
type as Display name:
Regards,
Rebecca Tu
TechNet Community Support

Similar Messages

  • Send Edit Items URL in E-Mail Using Sharepoint Designer 2013 WorkFlow

    Hi,
    I want to Send the URL of Edit Item List using SharePoint Designer 2013 Workflow
    I m Using [%Task : URL%] Then it return the internal URL -- 
    http://SP2013/Sites/MySites/HelloSites/Lists/Tasks/DispForm.aspx?ID=359&ContentTypeId=0x0108003365C4474CAE8C42BCE396314E88E51F
    But i want in  AAP URL for edit list items  such as 
    http://Hello.com/Sites/MySites/HelloSites/Lists/Tasks/DispForm.aspx?ID=359&ContentTypeId=0x0108003365C4474CAE8C42BCE396314E88E51F
    Any one can suggest me please.
    Thanks 
    Rajesh

    Hi, 
    I'm assuming you made your site as internet site (public facing).
    In that case you might site desired output. If not you can think of replacing text
    i.e SP2013 = hello.com
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • How to Loop through another list and update a column with SharePoint Designer 2013 Workflow

    Hi,
    I am trying to get my head around the new 2013 Workflow Engine and SharePoint Designer 2013 Workflow Text-Based Designer.
    I have two lists.
    List A has 2 columns: Title, Completed (Yes/No)
    List B has 3 columns: Title, LookupListATitle, Completed (Yes/No)
    All the 2013 Workflow components have been installed and configured and I am selecting the 2013 Workflow option in SPD
    I am trying to set off a 2013 Workflow when an item in List A is edited to Loop through List B and select items where the LookupListATitle column's value is equal to the Title value of the current item, and set the value of the Completed column for those
    items in ListB to "Yes".
    I have the Workflow configured like this:
    Stage: Stage 1
    IF Current Item:Completed equals Yes
    Loop: 1
    The contents of this loop will run repeatedly while: ListB:LookupListATitle equals Current Item: Title
    Update item in ListB. 
    (The dialog options for the update item action as follows:
    List: ListB
    Field: Completed, Value: Yes
    In the Find the List Item section
    Field: LookupListATitle
    Value: Current Item: Title)
    Transition to stage
    Go to End of Workflow
    When I update an item in ListA and set its Completed column to Yes, I would expect the Workflow to find all the items in List B where the Lookup column is equal to ListA's Title (there are 2) and update their Completed column to Yes. But it doesn't work.
    When I look at the Workflow Status it says the Internal Status is "Canceled" and the information pop up has the following alien language (and may be truncated):
    RequestorId: 95f03b62-8956-ac14-c5cf-dc98c89c589c. Details: System.ArgumentException: Invalid JSON primitive: Item001. Parameter name: value at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.ConvertStringToJsonNumber(String value) at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.ReadPrimitive(String
    type, XmlDictionaryReader jsonReader) at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.JXMLToJsonValue(XmlDictionaryReader jsonReader) at Microsoft.Workflow.Common.Json.JXmlToJsonValueConverter.JXMLToJsonValue(Stream jsonStream, Byte[] jsonBytes)
    at Microsoft.Activities.DynamicValue.ParseJson(String json) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
    executor, BookmarkManager bookmarkManager, Location resultLocation)
    Unfortunately I don't have access to the server, logs etc.
    I would love to find some tutorials, or any books on SharePoint Designer 2013 in general and Workflows in particular but my searches haven't turned up much so far apart from a pre-release Beginning SharePoint Workflows which is in its very early stages and
    not much help yet.
    Can anyone give me some guidance on how to set up While Loops to iterate through a related list using SharePoint Designer 2013?
    Mark

    Hi,
    I understand that you wanted to update the items in the other list (Participants) where the Course equals the Current Item.
    You need to use “Call HTTP Web Service" action and “Build Dictionary" action to get the Maxid and then loop Participants to update the items.
    You can follow the steps as below to achieve what you want:
    Create a custom list named Courses, add columns: Title(Single line of text), Course ID(Single line of text), Course Finalised (Yes/No).
    Create a custom list named Participants, add columns: Title(Single line of text), Course(Lookup), CourseFinalised (Yes/No).
    Create workflow associated to Courses, start the workflow automatically when an item is created or changed.
    Add conditions and actions:
    The HTTP URL is set to
    https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be order by Id and desc.
    Then if Course Finalised is equal to Yes, the CourseFinalised  of the associated items in Participants will be updated to Yes.
    More information:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/
    Thank you for your understanding.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • User Profiles option missing from SharePoint Designer 2013 workflows

    I noticed the User Profiles is missing as a Data Source option in the SharePoint Designer 2013 workflow platform (see image); whereas, it exists in the SharePoint 2010 workflow platform. Is there a way to connect this feature in SharePoint 2013 workflows
    by registering it or configuring through Workflow Manager? If not, what is the new approach in SP 2013 to call User Profiles services?

    Hi,
    Based on your description, you want to use user profile in SharePoint 2013 workflow.
    In SharePoint 2013 workflow user profiles is missing, if you have to use the user profile, you can create a SharePoint 2010 workflow, and use Start a List workflow action in 2013 workflow to start the 2010 workflow.
    The article below is about How to start a SharePoint 2010 Workflow within a SharePoint 2013 Workflow Using SharePoint Designer 2013
    http://www.c-sharpcorner.com/UploadFile/anavijai/how-to-start-a-sharepoint-2010-workflow-within-a-sharepoint/
    And in SharePoint 2013 there is an approach to user profile, you can add the action call http web service to get the information of user profile.  
    The article below is about how to use call http web service in SharePoint 2013 workflow.
    https://msdn.microsoft.com/en-us/library/office/dn567558.aspx
     Best regards
    Sara Fan
    TechNet Community Support

  • Can we migrate SharePoint Designer 2013 workflows from DEV to UAT to Live without any issues? Any bad experiences?

    Hi there,
    1. Can we migrate SharePoint Designer 2013 workflows from DEV to UAT to Live without any issues? Any bad experiences?
    2. When we deploy these workflows - does IIS need a restart?
    Thank you.

    That depends, did you create reusable workflows? Those can be deployed to another environment (of course depending on dependencies within the workflow itself)
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • Edir sharepoint designer 2013 workflow xaml

    How to edit sharepoint designer 2013 workflow xaml
    I was able to edit it by exporting wsp and cab and modified xaml but how to again create wsp of this modifed cab.
    I took reference of
    http://netwovenblogs.com/2013/12/10/export-sharepoint-designer-2013-workflow-xaml/
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Hi Amit,
    According to your description, my understanding is that you want to  re-create a .wsp file after modifying workflow xaml file from the cab file.
    To achieve it, you need to install a zip software utility that supports cab files, like IZArc. Then re-create a .cab file using the tool and change it to .wsp file.
    More information, please refer to the link:
    http://academy.bindtuning.com/how-to-manually-edit-a-sharepoint-wsp-file/
    I hope this helps.
    Thanks,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • How to create new subsite while adding new item to the list by using javascript?

    hi,
    I hav a task ie, when I add item to the list then subsite will create with that list item title and description . So By using javascript, I have to create subsite while adding new item to the list.
    Help me to solve this.
    Thank you, 

    Is your item getting added through Javascript client object model ? If yes, you can write in the success delegate of your list creation method the logic to create the subsite.
    function CreateListItem()
    var clientContext = new SP.ClientContext.get_current();
    var oList = clientContext.get_web().get_lists().getByTitle('List Name');
    var itemCreateInfo = new SP.ListItemCreationInformation();
    this.oListItem = oList.addItem(itemCreateInfo);
    oListItem.set_item('Title', 'My New Item!');
    oListItem.set_item('Body', 'Hello World!');
    oListItem.update();
    clientContext.load(oListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.CreateListItemOnSuccess), Function.createDelegate(this, this.onQueryFailed));
    function CreateListItemOnSuccess() {
    var subsiteTitle = oListItem.get_item('Title');
    //Logic to create a subsite
    function onQueryFailed(sender, args) {
    I have added a sample flow for the above scenario. Have a look at the following lnk for how you can craete a subsite using ecmascript.
    http://ravisoftltd.wordpress.com/2013/03/06/sharepoint-2010-create-site-with-ecma-script-with/
    Geetanjali Arora | My blogs |

  • Workflow created using sharepoint designer 2013 is not getting started and the initiator is Anonymous.

    Hi All,
    I have created a Site and List Workflow using SharePoint designer 2013, its a simple list workflow with one stage init on creating an item.
    When i verified the status of workflow its showing as initiator = Anonymous and Internal Status - Not started. Please a screen shot below
    Looking forward for your help.
    Thanks in Advance.
    Sunitha

    Below is the solution.
    Solution:.
    check
    list in workflow manager server  :
    1. Check https://[wfms]:12290 or http://[wfms]:12291 if they are responding 2. Check
    ”WorkflowMgmtPool” is started 3. Following services are running
    Workflow Manager Backend
    Service Bus Message Broker
    Service Bus Gateway
    Windows Fabric Host Service (FabricHostSvc)
    4. Get workflow farm information , workflow database  by  Start Workflow
    Manager PowerShell     get-WFfarm   5. Check if the Workflow Manager farm running(workflow service backend and  front end         should be rennin)  by  Start Workflow Manager
    PowerShell    get-WFfarmStatus
    6. Check oAut in accessible by http:// [wfms]:12291/$SYSTEM/$Metadata/json/1
    7. Restart the WorkflowServiceBackend service
    net stop WorkflowServiceBackend
    net start WorkflowServiceBackend
    Reference Link
    http://blogs.msdn.com/b/laleh/archive/2014/09/03/sharepoint-2013-workflow-troublehsooting.aspx
    Thanks all.
    Sunitha

  • SharePoint Designer 2013 -- Workflow Manager is required to create Workflow

    Hi,
    Is workflow manager is required to create workflow in SharePoint Designer 2013 for List Workflow. Is there any other alternative for this.
    With Regards,
    Jaskaran Singh Bhatti

    SharePoint 2013 supports both 2010 legacy type workflows that run in the OWS timer service on the SharePoint server and 2013 workflows that run on a server running Workflow Manager.  You can still create the same kind of workflows you created in SharePoint
    2010 without Workflow Manager.  That would include 2010 List Workflows.  You only need Workflow Manager if you want to create the newer kind of workflows that use Workflow Manager.  All the built-in workflows still use the 2010 legacy workflow
    system.  Both types of workflows can be created using SharePoint Designer 2013.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • SharePoint Designer 2013 Workflow not sending e-mails

    Hello everyone, it's me again.
    I have a problem with my custom workflow. A simple workflow made in SharePoint Designer 2013 with a "Send Mail" action isn't actually sending any e-mails.
    I am able to send mails with SharePoint 2013 with out-of-the-box workflows or alerts when sharing a page. The simple workflow is: Send Mail to TestUser after a new item has been created. 
    1) SMTP server has been configured and tested successfully, I am able to send mails
    2) The workflow gets "Completed" status even though I didn't actually receive a mail
    3) I double checked User Profiles and the e-mails are correct (I also checked in Active Directory)
    4) The User Profile Sync. Service is running and I even did a full sync
    5) Out of the box workflows are work perfectly fine
    I have no explanation why custom workflows won't send a mail. I can perform other actions like "change workflow status". 
    Any help please?

    Hi Ali,
    Please check if "send mail" action does not work in both SharePoint workflow 2010 platform and SharePoint 2013 platform.
    Please add the actions "log to history" before and after action "send mail" to check if the send mail action is performed.
    And you can also add "pause for a duration" before the "send mail" action, see if it could help.
    You may also check if there are some related ULS log.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Cannot send email using SharePoint designer 2013 workflow

    I am having a problem which I see many others have also posted about.  However, I don't find that any of their solutions fixes my problem.
    Using SharePoint 2013 on Windows 2008 R2 server.  SQL 2008 R2 on separate server.  Created a pretty simple workflow that calls for an email to be sent.  Created an Infopath form that is published to a SharePoint list.  One of the
    list fields is called "Approver" and is a people lookup field.  The workflow assigns an approver based on certain criteria in the list, and then sends an email to the assigned approver.
    During the testing phase of creating the workflow, I had the email sent to me specifically and I received the emails with no problems.  When I change the email recipient to Current Item:Approver (who is also me), I don't receive the email.  I have
    tried selecting Display Name, Email Address, and Login Name, but none work.  I also tried to send the email to the current item:creator (which was me) by selecting "User who created current item" from the select users dialog.  This also
    doesn't work.  The workflow is shown in a suspended state in the Workflow status screen.
    For informational purposes, I also included the Approver Display Name, the Approver Email Address and the Approver Login Name in the body of the email so that I could see what those fields actually returned as data.  The display name, and email address
    are correct, but the login name returned i:0#.w|domain\login (domain and login were my actual domain and login name).
    I have tried several of the fixes I found online to resolve this, but none have worked. Any help is appreciated.

    I don't see that it is possible to add CurrentItem:Creator to a list view.  The CurrentItem:CreatedBy returns my name as it should.  However, this does not help with my problem.  I don't want the email to come to me.  I want it to go
    to the CurrentItem:Approver.  This is a specific person who is assigned by the workflow based on various fields in the current item.  The approver is assigned, then an email is sent to the assigned person.
    There is a SharePoint group set up for Approvers.  This is used to assign permissions to the site where this list is created.
    Basically, I can't send an email to any recipient where I am using the current item lookup fields to populate the To: field.  I can only send email if I specifically select a person by name.

  • Import SharePoint Designer 2013 workflows into Visual Studio 2012

    I have some 2013 workflows created with SharePoint Designer 2013. I can save the workflows as templates ie WSP files but i cannot figure out how to import them into visual studio 2012. Is this possible? please note the import resusable workflows option
    is for sharepoint 2010.

    "The workflow activities/actions are in separate assemblies, and each tool references a different one." so you will get an error when you try to open the SPD workflow using Visual Studio.
    Please check similar thread below for more details
    http://sharepoint.stackexchange.com/questions/75196/importing-a-sharepoint-2013-workflow-in-visual-studio
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • When connecting to a server farm in sharepoint foundation 2013 cannot create new farm error: One or more types failed to load

    When trying to create a new server farm in the sharepoint foundation 2013 we get a following error :
    The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.
    PS C:\Users\Administrator> New-SPConfigurationDatabase
    cmdlet New-SPConfigurationDatabase at command pipeline position 1
    Supply values for the following parameters:
    DatabaseName: SharePoint_Config
    DatabaseServer: PC78\SQLEXPRESS,25111
    FarmCredentials
    Passphrase: *********
    New-SPConfigurationDatabase : One or more types failed to load. Please refer
    to the upgrade log for more details.
    At line:1 char:1
    + New-SPConfigurationDatabase
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Share...urationDatabase:
    SPCmdletNewSPConfigurationDatabase) [New-SPConfigurationDatabase], SPUpgra
    deException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPCon
    figurationDatabase
    And the error log is shown below :
    Microsoft.SharePoint.Upgrade.SPUpgradeException: One or more types failed to load.
    Please refer to the upgrade log for more details.
    at Microsoft.SharePoint.Upgrade.SPActionSequence.LoadUpgradeActions()
    at Microsoft.SharePoint.Upgrade.SPActionSequence.get_ActionsInternal()
    at Microsoft.SharePoint.Upgrade.SPUtility.GetLatestTargetSchemaVersionByMajorVersion(Type typeActionSequence, Int32 majorVer)
    at Microsoft.SharePoint.Upgrade.SPUtility.get_CurrentSPSiteWssTargetSchemaVersion()
    at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPContentDatabase database, SPSiteSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID, Int32 compatibilityLevel, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, Strin... b712a522-fa85-49eb-b59c-dedf55295504
    ...g secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, String quotaTemplate, String sscRootWebUrl, Boolean useHostHeaderAsSiteName, Boolean overrideCompatibilityRestriction)
    at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPSiteSubscription siteSubscription, String siteUrl, String title, String description, UInt32 nLCID, Int32 compatibilityLevel, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, Boolean useHostHeaderAsSiteName)
    at Microsoft.SharePoint.Administration.SPAdministrationWebApplication.CreateDefaultInstance(SqlConnectionStringBuilder administrationContentDatabase, SPWebService adminService, IdentityType identityType, ... b712a522-fa85-49eb-b59c-dedf55295504
    ...String farmUser, SecureString farmPassword)
    at Microsoft.SharePoint.Administration.SPFarm.CreateAdministrationWebService(SqlConnectionStringBuilder administrationContentDatabase, IdentityType identityType, String farmUser, SecureString farmPassword)
    at Microsoft.SharePoint.Administration.SPFarm.CreateBasicServices(SqlConnectionStringBuilder administrationContentDatabase, IdentityType identityType, String farmUser, SecureString farmPassword)
    at Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuilder configurationDatabase, SqlConnectionStringBuilder administrationContentDatabase, IdentityType identityType, String farmUser, SecureString farmPassword, SecureString masterPassphrase)
    at Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuil... b712a522-fa85-49eb-b59c-dedf55295504
    ...der configurationDatabase, SqlConnectionStringBuilder administrationContentDatabase, String farmUser, SecureString farmPassword, SecureString masterPassphrase)
    at Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase.InternalProcessRecord()
    at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord() b712a522-fa85-49eb-b59c-dedf55295504
    Error Category: InvalidData Target Object Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase Details NULL RecommendedAction NULL b712a522-fa85-49eb-b59c-dedf55295504
    Leaving ProcessRecord Method of New-SPConfigurationDatabase. e9ae5ba6-c499-0000-d35c-aee999c4cf01
    we are using server 2012 R2 and we don't have office 2010 installed

    Yes,SQL server is on the same server as SharePoint 
    SQL has both the permissions Securityadmin
    and  DBcreator roles on SQL Server.
    When we run those sharepoint management shell commands the database  will be created with the error
    msg (shown in attachment)

  • SharePoint Designer 2013 Workflow Fails to open.

    I've been trying for a day or so to get this 2013 workflow to open up in sharepoint designer. 
    Everytime I get the following error
    "Field to load this workflow. To correct this problem, restart SharePoint Designer."
    Then when I refresh the screen I get this error.
    "Windows Workflow Foundation, part of .Net Framework 3.0, must be installed to use this feature."
    I've tried logging into SharePoint Designer with different accounts, I've delete the cache  
    %APPDATA%\Microsoft\Web
    Server Extensions\Cache
    %APPDATA%\Microsoft\SharePoint
    Designer\ProxyAssemblyCache
    %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
    Before for I say this workflow has been corrupted. I have a question to ask.
    Would content databases needing to be upgraded after a CU cause this error?
    Thanks
    James T.F

    The issue may not be an infrastructure one but involve problems with the structure of the workflow itself.  For example, I have found that if the workflow design has a type mismatch involving variable assignments, this presents with the error above. 
    Does the workflow implement error control?  Have the workflow designer very carefully review the workflow to find any potential problems.
    Also... The problem with workflows is that they do not have a robust compiler or error handler to capture and inform you of errors involving the workflow itself.  The reference below provides links to other pertinent postings on this vary issue.
    References
    SharePoint 2013: Failed to load this workflow
    General

  • Sharepoint designer 2013 workflow kickoff issue from code

    Problem Statement: Start a  SharePoint 2013 designer Reusable Workflow with STS Authenticated User. We are trying to start to SharePoint 2013 designer Reusable Workflow with
    STS authenticated user using code but when we do that, we get following error. RequestorId: a3ce6dc6-31ec-23f3-0000-000000000000. Details: RequestorId: a3ce6dc6-31ec-23f3-0000-000000000000. Details: An unhandled exception occurred during the
    execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {"error_description":"The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults
    (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect
    the server trace logs."} {"x-ms-diagnostics":["3001000;reason=\"There has been an error authenticating the request.\";category=\"invalid_client\""],"SPRequestGuid":["a3ce6dc6-31ec-23f3-b3ab-aef56fc7e299"],"request-id":["a3ce6dc6-31ec-23f3-b3ab-aef56fc7e299"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"SPRequestDuration":["65"],"SPIisLatency":["0"],"Server":["Microsoft-IIS\/8.0"],"WWW-Authenticate":["Bearer
    realm=\"de9da885-f7bf-4564-a3a5-
    Alternate approach we are following : We have created a windows authenticated user and gave him all the necessary permission to trigger the workflow(contribute, full control). Then we are creating the User token
    for that user and opening the site with the help of the generated user token. By this approach workflow is getting triggered.
    The problem in this approach is after ¾ days it gives error when trying to kick off workflow from code with user who has not logged in as we are using this AD user only for kickoff purpose.
    InvalidOperationException:
    Operation is not valid due to the current state of the object
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    There is a userprofile for the user and the issue is not a userprofile. We are using direct AD import and we have full sync every 5 minutes. The workflow gets kicked off using a fix user who never logs in but after 4/5 days the token or something gets expired
    and then we have to manually login with that user and then only code can kickoff workflow with that particular user.
    The problem in this approach is after ¾ days it gives error when trying to kick off workflow from code with user who has not logged in as we are using this AD user only for kickoff purpose.
    InvalidOperationException:
    Operation is not valid due to the current state of the object
    We can not kickoff with current user as current user can not be given contribute rights and we can not do it with system account as its not able to kickoff using system account by design of sp2013 workflow.
    So we need to know how to kcikoff workflow with a user who never logs in or logs in only for the first time and then never in production.
    Below code works for few days and then as user does not login with which we kick off workflow the token or something gets expired after 4/5 days.
    userToken = oSPWeb.EnsureUser(“UserAccountName”).UserToken;
    using (SPSite
    oSPSite = new
    SPSite(SPContext.Current.Web.Url,
    userToken))  //Site collection URL
    using (SPWeb
    oSPWeb = oSPSite.OpenWeb())  //Subsite URL
    SPList list = oSPWeb.Lists["Proposal"];
    try
                                oSPWeb.AllowUnsafeUpdates =
    true;
    SPListItem item = list.GetItemById(proposalID);
    var workflowServiceManager =
    new
    WorkflowServicesManager(oSPWeb);
    var workflowSubscriptionService = workflowServiceManager.GetWorkflowSubscriptionService();
                                //get
    all workflows associated with the list
    var subscriptions = workflowSubscriptionService.EnumerateSubscriptionsByList(list.ID);
    foreach (var
    workflowSubscription in subscriptions)
    if (workflowSubscription.Name ==
    "Proposal Workflow")
    //initiation parameters
    var inputParameters =
    new
    Dictionary<string,
    object>();
    inputParameters.Add("Comments",
    "TEST");
    inputParameters.Add("ItemId", item.ID);
    inputParameters.Add("WorkflowStart",
    "StartWorkflow");
    workflowServiceManager.GetWorkflowInstanceService().StartWorkflowOnListItem(workflowSubscription, item.ID, inputParameters);
    break;
                                oSPWeb.AllowUnsafeUpdates =
    false;
    catch (Exception
    ex)
                                Classes.Logger.WriteErrorLog("Sumbit",
    "kickoffWorkflow1", ex,
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

Maybe you are looking for