locked
Business Process Flow for old records RRS feed

  • Question

  • A customer has asked us to decommission the Business Process Flow for a particular security role.

    I have done this and all is well for new records.

    Unfortunately the Process Bar still appears for old Leads.  I think I can understand the behaviour: if you change the process, the old records will still show process bar that existed at the time they were created.  This includes removing it presumably.

    My question is, can I remove the legacy instances of the process bar either through the interface or by code?

    Monday, February 16, 2015 5:05 PM

Answers

  • Hello,

    Done that in one of projects. Just created DTS and updated processid and stageid fields with null value.


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Monday, February 16, 2015 5:20 PM
    Moderator
  • In Crm 2013, I don't think there's a supported way to do this is bulk via the front-end, but a command-line tool that sets processed and staged to null will do this.

    In Crm 2015, you may be able to use client-script on the form to do this, but a user would have to open each record for this to apply


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, February 16, 2015 9:30 PM
    Moderator

All replies

  • Hello,

    Done that in one of projects. Just created DTS and updated processid and stageid fields with null value.


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Monday, February 16, 2015 5:20 PM
    Moderator
  • I can see those fields in the entity so that's a good start.

    By DTS, are you meaning SQL or are you doing some king of CRM bulk update through the interface?  I'm online so I have no SQL level access.

    I can write a command line tool to do this if there is no supported way though the front end.

    Monday, February 16, 2015 6:32 PM
  • In Crm 2013, I don't think there's a supported way to do this is bulk via the front-end, but a command-line tool that sets processed and staged to null will do this.

    In Crm 2015, you may be able to use client-script on the form to do this, but a user would have to open each record for this to apply


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, February 16, 2015 9:30 PM
    Moderator
  • For such bulk tasks I use SSIS Integration Tookit for Dynamics CRM.

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Tuesday, February 17, 2015 2:16 AM
    Moderator
  • Update: I created a command line to update the stageid and processid to NULL.

    These fields are now clear, however when I open an affected record the form pops up an error message:

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Cannot insert duplicate key.Detail: 
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147220937</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>Cannot insert duplicate key.</Message>
      <Timestamp>2015-02-19T14:37:12.1391627Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText>
    
    [Microsoft.Crm.ObjectModel: Microsoft.Crm.ObjectModel.GlobalActiveStagePlugin]
    [bb48066e-f22f-412f-a530-91f72e4b859b: GlobalActiveStagePlugin]
    
    
    </TraceText>
    </OrganizationServiceFault>
    

    I can see that the Process Bar is still showing.

    Is there something else I would need to do?

    Gordon

    Thursday, February 19, 2015 2:41 PM
  • Haven't seen anything similar...

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Thursday, February 19, 2015 3:31 PM
    Moderator
  • is the business process flow deactivated?

    please run a SQL query against the base table to see if the processor and stageid fields are null.

    regards

    Jithesh

    Thursday, February 19, 2015 9:34 PM
  • Hi Gordon,

    Did you find a solution to the cannot insert duplicate key after setting the stageid and processid to NULL.

    I found that updating it back to another business process flow resolves the error, however ideally looking to disassociate as the particular entity should not have any business process flows.

    Regards,

    Allan


    • Edited by Allan Ho Tuesday, June 9, 2015 12:21 PM
    Tuesday, June 9, 2015 11:13 AM
  • I've had the cannot insert duplicate key error as well.

    I turned to the businessprocessflowinstance table and found a correct record.

    Then I turned to the contact table and found out that the contact record did not contain a processid.

    Updating the processid in the contact table with the correct businessprocessflow id solved the problem, you can use the CRM SDK for this.

    • Proposed as answer by Rick Basten Wednesday, November 11, 2015 8:37 AM
    Wednesday, November 11, 2015 8:36 AM
  • Hi Rick,

    I'm having this exact issue now. I have a BPF on a custom entity and I can see the processid is NULL. How exactly can I use the SDK to update it??

    Thanks in advance.

    Rich

    Wednesday, September 7, 2016 4:56 PM
  • Hi Rich,

    If you are using the ON PREM instance, please apply the following script in your org db.

    update account set  --<<Replace the Entity name>>
    Processid = '0CEA0B65-0447-4D1D-B060-C70B63EFB1E7' --<<Correct Process ID>>
    where
    accountid in ('XXXX') --<<Replace the attribute name>>

    Regards
    Bala

    • Proposed as answer by Balamurugan B Friday, February 3, 2017 6:02 PM
    Friday, February 3, 2017 5:43 PM