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);
This blog describes mostly about the work (CRM 365, CRM 2016, CRM 2015, CRM2011, CRM 4.0, CRM 3.0, C#,Javascript and SQL Server) i do.
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
Adding is working:). Deletion is not working :(
ReplyDeleteIs this CRM 2011 are you talking about.
DeleteIf so try the below.
Xrm.Page.getControl('FileName').removeOption(3);
HI,
ReplyDeleteThanks 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?
Hi Kaviya,
ReplyDeleteCould 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
Hi Charith,
ReplyDeleteThanks 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.
Hi Kaviya,
ReplyDeleteApologies for the late reply.
Are you trying to add new option set values which are not in the option set?.
Charith