locked
Workflow terminates with error 'systemuser wWith Id = xxx Does Not Exist' RRS feed

  • Question

  • Hello,

    I'm encountering a strange problem. I have a workflow which triggers when an entity is created. It has the following steps.

    Step 1: Update the lookup field to link to a record in the Autonumber entity.

    Step 2: Set the record number field to the value of the Counter field in the Autonumber entity.

    Step 3: Increment the counter field in the Autonumber entity with the value of the Increment By field in the same entity.

    I use such workflows as a means of getting an Autonumber. This worked fine until I decided to import my unmanaged solution to another organisation. In this new organisation this workflow throws the following error on Step 1.

    Sync workflow 'SP Electrical Autonumber' terminated with error 'systemuser With Id = 1901130da-..... Does Not Exist'

    This is odd as I'm creating the entity so the workflow is set to run as the 'The user who made changes to the record' and I've got the System Administrator profile. Further my GUID is different to the above guid and my guid exists in the database. So I'm struggling to understand where its getting this guid from.

    I've checked the Autonumber record in the first step using (Select * from Filteredcal_autonumber) and couldnt find the guid in the error message anywhere there too!

    So where is it getting this guid and why is it that just this workflow is throwing this error. Other entities use similar workflows for their autonumbers and they seem to work fine. Any ideas? Or places to look would be much appreciated. I've investigated this myself a lot and only posting here as a last resort as I'm really out of ideas. 

    My next step is to delete the entire workflow and recreate it again and see if this solves the issue. But I still want to know why I'm experiencing this. I'll post back on whether deleting and recreating the workflow solved the issue. 

    PS. CRM 2013
    • Edited by cybermanlegolas Tuesday, August 8, 2017 7:39 AM Forgot to mention CRM version.
    Tuesday, August 8, 2017 7:38 AM

Answers

  • Ok so glad I got to the bottom of this. This is another CRM gotcha!!!

    The issue wasnt with the workflow at all. Inspite of deactivating the workflow I was still getting the error. On discussing with a work colleague we concluded that one possibility where a GUID from an older organisation might have been inserted was Visual Studio. The old organisation used custom plugins and they were held in Visual Studio. When I imported the solution to a new organisation, I continued to use Visual Studio to make changes to these plugins. I continued to deploy them to the new organisation. This made Visual Studio transfer the old guids to the new organisation.

    What I should have done is, in VS when you connect to a new organisation, you need to open the RegisterFile.crmregister file that you will find in the Deploy project and set any Id='[guid here]' to Id='000000-0000-0000-0000-000000000000' so that when you deploy new fresh GUIDs from the new organisation are created and stored.

    To fix my problem, I unregistered the plugins, then reset the IDs in the file as above and then redeployed the plugins! Voila! Everything works now!

    Wednesday, August 9, 2017 6:42 AM

All replies

  • Update: I've just recreated the workflow and it hasnt changed a thing. I'm still getting the above error.
    Tuesday, August 8, 2017 7:58 AM
  • Did you recreate the workflow from scratch?

    When you export a workflow and import to another organization and the workflow has a fixed lookup for users or other records then they will fail when the record does not exist in the new organization with the same guid.

    F.e. if you assign a record to a specific user, then it is not enough for the user to exist, it has to exist with the same guid.

    If you have recreated the workflow from scratch and still get the error, then the problem lies somwhere else, even though it might seem the workflow has the error it might be a plugin f.e.,

    did your solution have a plugin where the plugin is running in a specific user context?
    does the workflow run in a specific users context?
    Is there somewhere in your code, custom workflow activity or a plugin that has a hard coded guid for a user?
    Do you have trace information for the error itself?

    Best regards,
    Halldor


    Halldór Jóhannsson


    Tuesday, August 8, 2017 1:00 PM
  • Ok so glad I got to the bottom of this. This is another CRM gotcha!!!

    The issue wasnt with the workflow at all. Inspite of deactivating the workflow I was still getting the error. On discussing with a work colleague we concluded that one possibility where a GUID from an older organisation might have been inserted was Visual Studio. The old organisation used custom plugins and they were held in Visual Studio. When I imported the solution to a new organisation, I continued to use Visual Studio to make changes to these plugins. I continued to deploy them to the new organisation. This made Visual Studio transfer the old guids to the new organisation.

    What I should have done is, in VS when you connect to a new organisation, you need to open the RegisterFile.crmregister file that you will find in the Deploy project and set any Id='[guid here]' to Id='000000-0000-0000-0000-000000000000' so that when you deploy new fresh GUIDs from the new organisation are created and stored.

    To fix my problem, I unregistered the plugins, then reset the IDs in the file as above and then redeployed the plugins! Voila! Everything works now!

    Wednesday, August 9, 2017 6:42 AM
  • Good to know you got this sorted out 8)

    Halldór Jóhannsson

    Wednesday, August 9, 2017 8:57 AM