locked
CRM 2015 Online, access field control from an inactive stage of business process flow RRS feed

  • Question

  • Hi,

    I am trying to hide two option values from an option set.  The option set is in both the form and the business process flow.  Using javescript Xrm.Page.getControl("header_process_XXXXX"), I can access the field in the process flow when the stage is active.  After the business process flow moves to next stage, the stage the field is in is no longer active, therefore, the field is not accessible any more. and Xrm.Page.getControl("header_process_XXXXX") returns null.  So, is there a way around of this to access the field in an inactive stage?  Thanks.

    Wednesday, November 18, 2015 5:34 PM

Answers

All replies

  • Hello,

    Just curious why do you need it?


    Dynamics CRM MVP
    My blog

    Wednesday, November 18, 2015 9:35 PM
    Moderator
  • Hi, Andrii-

    Use RemoveOption() to hide the option values from the same option set but in BPF.  Xrm.Page.getControl("header_process_XXXXX") works fine when this option set is in the active stage, say Stage 1, in process.  After moving to next stage, Say Stage2, Xrm.Page.getControl("header_process_XXXXX") will return null when javascript code accesses this option set in Stage 1.

    Thursday, November 19, 2015 4:17 AM
  • Hello,

    So the answer is - add code that will handle change of stage event on client side, check if control is available after stage is changed and filter your picklist. Recheck this article that describes it - https://msdn.microsoft.com/en-us/library/d88d5f21-6385-443b-91f2-0ec0c16b1324#BKMK_OnStageChange


    Dynamics CRM MVP
    My blog

    • Marked as answer by chicago bq Thursday, November 19, 2015 9:34 PM
    Thursday, November 19, 2015 3:50 PM
    Moderator
  • Hi, Andrii-

    After I inserted the following 2 methods in javascriot, hiding Option Set values works in both CRM form and Business Process Flow.             

            Xrm.Page.data.process.addOnStageChange(myfunction);
            Xrm.Page.data.process.addOnStageSelected(myfunction);

    Is there a way to add method to handle OnStageChange and OnStageSelected at design time like we do OnLoad event for form?

    Thursday, November 19, 2015 9:37 PM

  • Is there a way to add method to handle OnStageChange and OnStageSelected at design time like we do OnLoad event for form?

    Glad that you were able to solve your issue. Seems that there is no way of doing it in customization way.

    Dynamics CRM MVP
    My blog

    Thursday, November 19, 2015 10:00 PM
    Moderator