Friday, March 18, 2011

Adding and Deleting Values from CRM picklist using Javascripts

Adding a value to a CRM Picklist 
document.getElementById('fieldname').AddOption('Test', 3);

Deleting a value from a CRM Picklist 
document.getElementById('fieldname').DeleteOption(2);

6 comments:

  1. Adding is working:). Deletion is not working :(

    ReplyDelete
    Replies
    1. Is this CRM 2011 are you talking about.
      If so try the below.

      Xrm.Page.getControl('FileName').removeOption(3);

      Delete
  2. HI,

    Thanks for your post.

    I have a CRM(2011) picklist, which is mandatory.adding option as said in the above method working properly in crm form, But if i'm clicking the save its showing an error message, please select any option in case type (Picklist name). Actually the data is not stored in data base, the value is added only on the form.

    Could you please give proper solution for insert the value to picklist?

    ReplyDelete
  3. Hi Kaviya,

    Could you please add the javascript that you are using.

    The values that you are adding to the picklist, are these values exist in the picklist or these are new values?.

    have the value being selected for the picklist before you save it.(it must be as it is a mandatory field).

    Charith

    ReplyDelete
  4. Hi Charith,

    Thanks for ur reply.

    this is my JS code
    document.getElementById('fieldname').AddOption('Test', 3);

    I'm adding new values not an existing values.

    Thanks ,
    Kavi.

    ReplyDelete
  5. Hi Kaviya,

    Apologies for the late reply.
    Are you trying to add new option set values which are not in the option set?.

    Charith

    ReplyDelete

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...