Forums

Forums / Developing Portals / CRM Yes/No Widget Default Value

CRM Yes/No Widget Default Value

Thread is closed for posting
9 posts, 2 answered
  1. vmeesaraganda
    vmeesaraganda avatar
    48 posts
    Registered:
    19 Mar 2015
    07 Apr 2015
    Link to this post
    Hi
    We have a CRM Yes/no Widget on a form and its default value in CRM is No.
    But the CRM Yes/no Widget is not showing NO as selected by default on opening the form.
  2. Clinton Bale
    Clinton Bale avatar
    126 posts
    Registered:
    21 Feb 2014
    07 Apr 2015 in reply to vmeesaraganda
    Link to this post
    Hello,

    Default Values for CRM Yes/No widgets will be supported in The Portal Connector v3.0. For the Portal Connector v2.4 the best way to accomplish this is to write custom JavaScript to set the value of the field if it has no value on load.

    Regards,
    Clinton
  3. vmeesaraganda
    vmeesaraganda avatar
    48 posts
    Registered:
    19 Mar 2015
    07 Apr 2015 in reply to Clinton Bale
    Link to this post
    Hi Clinton
    I am able to set the value using the following code and it seems to be working fine however the radio control doesn't appear to be selected i.e. they both look unchecked.
    $find($(".atos_isserviceorinformation").attr("id")).set_boolText("true"); 
  4. Clinton Bale
    Clinton Bale avatar
    126 posts
    Registered:
    21 Feb 2014
    Answered
    07 Apr 2015 in reply to vmeesaraganda
    Link to this post
    Using that same snippet with a completely clear radio button CRM Yes/No field I was able to change the checked status to true. You must ensure the form is fully loaded before you can make any changes like these. Try wrapping the snippet in a window.load or document.ready event.
  5. vmeesaraganda
    vmeesaraganda avatar
    48 posts
    Registered:
    19 Mar 2015
    08 Apr 2015 in reply to Clinton Bale
    Link to this post
    Hello Clinton

    Yes i tried this on load of page it worked for CRM Yes/No Widget but i tried the same with CRM Picklist Widget with the following code it didn't worked. Can you please advise.
    find($(".fieldname").attr("id")).set_selectedText("itemname"); 
    Last modified on 08 Apr 2015 17:04 by vmeesaraganda
  6. Clinton Bale
    Clinton Bale avatar
    126 posts
    Registered:
    21 Feb 2014
    08 Apr 2015 in reply to vmeesaraganda
    Link to this post
    Hello Vamsidhar,

    Just to note, the CRM Picklist API does not work if the control is in Read-Only mode, otherwise: If the set_selectedText function does not work the RadComboBox API cannot find any values in the list with the item that matches that text.

    An easier way to accomplish this is to use the set_value function and pass in the numeric value for that picklist option.

    You could also try working with the RadComboBox API yourself by calling get_cboPicklist() and using the functions that that object provides.

    Cheers,
    Clinton

    Last modified on 10 Apr 2015 13:04 by Clinton Bale
  7. vmeesaraganda
    vmeesaraganda avatar
    48 posts
    Registered:
    19 Mar 2015
    10 Apr 2015 in reply to Clinton Bale
    Link to this post
    Hello Clinton,

    I tried the following code on page load but no luck still the value is not appearing as selected.
    find($(".fieldname").attr("id")).set_value("4");
  8. Clinton Bale
    Clinton Bale avatar
    126 posts
    Registered:
    21 Feb 2014
    Answered
    10 Apr 2015 in reply to vmeesaraganda
    Link to this post
    Hello Vamsidhar,

    I apologize, the set_value function does indeed set the value, but it will not update what is displayed in the pick list. To set the value and update the display on the pick list use the following snippet:

    $find($(".fieldName").attr("id")).get_cboPicklist().findItemByValue("4").select();

    Best Regards,
    Clinton
  9. vmeesaraganda
    vmeesaraganda avatar
    48 posts
    Registered:
    19 Mar 2015
    13 Apr 2015 in reply to Clinton Bale
    Link to this post
    Hi Clinton 

    Thanks for the Code Snippet, it working.
9 posts, 2 answered