locked
Hide pick list-value RRS feed

  • Question

  • Hi

    Im using the following script to hide options from a piclist. 
    It works great in one of our oragnisations but not antoher one. Both of them is CRM 2013. 
    Anyone know why??

    Thanks. 


    function hideoption()

    {

    var status = Xrm.Page.data.entity.attributes.get("stc_autogiro_status").getValue();

    if (status == 1) 
     
    {
    Xrm.Page.getControl("stc_autogiro_status").removeOption(6);
    Xrm.Page.getControl("stc_autogiro_status").removeOption(3);
    Xrm.Page.getControl("stc_autogiro_status").removeOption(4);
    Xrm.Page.getControl("stc_autogiro_status").removeOption(5);

    }


    }

    Wednesday, October 1, 2014 9:21 AM

All replies

  • Hi Filfr,

    Check whether Option set Values are correct for this organisation.

    For different organisations Option set Values are different.

    your code looks fine. Debug your code and check whether it's entering the If condition.

    Regards,

    Saad


    • Edited by Mohd Saad Wednesday, October 1, 2014 9:41 AM added clarification
    Wednesday, October 1, 2014 9:28 AM
  • Thank you. 

    The option set values is exactly the same, we have used the same solution and import it from the first organisation. 

    I have also debuged the code and it entering the If-condition so im really lost about this. 

    /Filip

    Wednesday, October 1, 2014 9:50 AM
  • Hi Filip,

    I tried your code in my environment and it runs fine. Please recheck your option set values of field stc_autogiro_status.

    My rollup version is UR 3.

    Saad


    • Edited by Mohd Saad Wednesday, October 1, 2014 10:05 AM added rollup
    Wednesday, October 1, 2014 10:04 AM
  • Hi ,

    ur code seems to be true. Also can you try the below code?

    var control = Xrm.Page.ui.controls.get("stc_autogiro_status");
     control.removeOption(3);
    
     control.removeOption(4);
    
     control.removeOption(5);
    
     control.removeOption(6);
    


    Polat Aydın Crm Software Developer

    Wednesday, October 1, 2014 10:25 AM
  • please check if the  schema name of the attribute "stc_autogiro_status" is the same in both the environments.
    Wednesday, October 1, 2014 1:18 PM
  • Thanks. 

    Suddenly it started do work without any customizations.   And i have no idea wyh :) 

    Thursday, October 9, 2014 12:59 PM