Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)
Posted on by 130

hi

i have option set field value is A,B,C,D . if i select a D value it show single line text box on left and type any text in single line box it come on option set field and other value a,b,c,d will hide

how could i do it it is possible or not 

*This post is locked for comments

  • Suggested answer
    crm development Profile Picture
    crm development 870 on at
    RE: hi

    As mentioned in thread,

    Add textbox value to existing option set's metadata using metadata service call using js code like below:

    // Create a request.

    InsertOptionValueRequest insertOptionValueRequest =

      new InsertOptionValueRequest {

      AttributeLogicalName = "new_picklist",

      EntityLogicalName = Contact.EntityLogicalName,

      Label = new Label("New Picklist Label", _languageCode)

    };

    // Execute the request.

    int insertOptionValue = ((InsertOptionValueResponse)_serviceProxy.Execute(

    insertOptionValueRequest)).NewOptionValue;

    Refer: msdn.microsoft.com/.../gg509035.aspx

    Then Write a SOAP call, You can convert above code to client side using SOAP logger available in SDK

    nishantrana.me/.../updated-soaplogger-for-crm-2013-to-generate-javascript

    Thanks,

    Anand

  • Suggested answer
    crm development Profile Picture
    crm development 870 on at
    RE: hi

    Hi, Please refer the threads for code.

    community.dynamics.com/.../168756

    msdn.microsoft.com/.../gg509035.aspx

    Thanks,

    Anand

  • Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: hi

    Hi,

    What exactly you want to achieve. could you specify all in one time?

  • himy10 Profile Picture
    himy10 130 on at
    RE: hi

    type*

  • himy10 Profile Picture
    himy10 130 on at
    RE: hi

    thanks but i want to do that if i select d in optionset field  converted text formate  / opne text form

    in that type any thing that save on option set field

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: hi

    Hi,

    You can refer below code.

    below v9.0

    function shohidefield()
    
    {
    
    var optionsetvalue=Xrm.Page.getAttribute("providefieldSchemaNamehere").getValue();
    
    if(optionsetvalue=="value here)
    
    {
    
    Xrm.Page.getControl('fieldname').setVisible(bool); // true = show ; false = hide
    
    }
    
    else
    
    {
    
    Xrm.Page.getControl('fieldname').setVisible(bool);// true = show ; false = hide
    
    }
    
    }


    above 9.0

    function showhidefield(executioncontext)
    
    {
    
     var formContext = executionContext.getFormContext();
    
    var optionsetvalue=formContext.getAttribute("providefieldSchemaNamehere").getValue();
    
    if(optionsetvalue=="value here)
    
    {
    
    formContext.getControl('fieldname').setVisible(bool); // Specify true to show the control; false to hide the control.
    
    }
    
    else
    
    {
    
    formContext.getControl('fieldname').setVisible(bool);// Specify true to show the control; false to hide the control.
    
    }
    
    }


  • himy10 Profile Picture
    himy10 130 on at
    RE: hi

    thanks for replya can u plz suggest code

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: hi

    Hi himy,

    If you want to show or hide fields based on the option value, you could use Business Rules.

    For exaxple:

    When I set "option height"(an option set field)= "C", then "Stage Name"(a single line text box) displays.

    community142.png

    About your requirement "hiding a,b,c,d values", do you mean you want to set the value of single text box to the option set field and remove all other fields(including "D")? Why don't you use the value of text box directly? Values cannot be assigned between different types of fields with OOB functions.

    If you must do this, you could use code to add the value of text box to the option set and then set it to be selected.

    In addition, could you kindly share more information about the complete requirement?

    Hope it helps.

    Best Regards,

    Leo

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: hi

    Hi,

    you can easily achieve this with business rule. Refer below blog.

    heidster12.wordpress.com/.../showhide-fields-with-business-rules

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: hi

    Hi There,

    Please use business rule to achieve any hide/show based on value on a form.

    docs.microsoft.com/.../create-business-rules-recommendations-apply-logic-form  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans