locked
Dynamics 365 online - how to change BPF traversed path of imported opportunity RRS feed

  • Question

  • Hi,

    We have imported a bunch of opportunities which need to be in a specific BPF state into Dynamics 365 (online). The BPF contains multiple conditions and paths, so it looks something like this.

    [Stage1] -- IF X -- [Stage2] -> [Stage3] -> [Final Stage]
                  -- IF Y -- [Stage4] -> [Stage5] /
                  -- IF Z -- [Stage6] -> [Stage7] /

    So they all start in [Stage1] and end up in [Final Stage], but the path is different.

    Could be [Stage1]->[Stage2]->[Stage3]->[Final Stage]
    or [Stage1]->[Stage4]->[Stage5]->[Final Stage]
    etc.

    When the opportunity is created directly in CRM in the initial Stage1, everything works correctly.

    But when we import it and set the processingStageId to [Stage5] (for example) it ends up going through all the previous stages, so it looks something like this:
     [Stage1]->[Stage2]->[Stage3]->[Stage4]->[Stage5]

    We would like to change it to [Stage1]->[Stage4]->[Stage5]

    I have tried updating (via SDK update of entity) the traversedpath attribute of the opportunity, but it doesn't update. It doesn't throw any errors when trying, but it doesn't do anything.

    Update code is something like this:

    Entity entity = new Entity("opportunity");
    entity["opportunityid"] = opportunityId;
    entity["traversedpath"] = "faa90e07-a987-4537-a7ba-53a6cdafa1fd,2431e8c8-aeb1-4d82-a6a5-0dbfa396df1d";
    
    orgService.Update(entity);


    Then I read about D365 having these new dedicated entities for each BPF. I was able to find that entity and the specific record related to the opportunity I tested on. I even was able to update the traversed path on that record, thinking that maybe the traversed path on the opportunity will then recalculate (or even that is just a field in a view, that takes data from the actual BPF record).

    Entity entity = new Entity("my_bpf");
    entity["businessprocessflowinstanceid"] = new Guid("056361f6-eb2b-e711-80ff-5065f38bd231");
    entity["traversedpath"] = "faa90e07-a987-4537-a7ba-53a6cdafa1fd,2431e8c8-aeb1-4d82-a6a5-0dbfa396df1d";
    
    orgService.Update(entity);

    I can see that the traversedpath is actually being updated, but it didn't change anything on the opportunity. Except that the go forward/go back operations started failing now -> since the system is in an inconsistent state.

    Any idea how I can solve this in D365 online? If this was on-premise I would probably look into the database, but since it's an online environment I cannot do that.

    Would really appreciate any help!


    • Edited by kowgli Friday, April 28, 2017 11:40 AM
    Friday, April 28, 2017 11:38 AM