locked
How to assign picklist attribute value in crm 4.0 RRS feed

  • Question

  • Hi,

    I am using custom .aspx page.

    In this I am retrieving all the entity attributes and assigning to arraylist.

    I am taking the picklist attribute value from arraylist but not able to assign this value to variable.

    How can i do this in custom .aspx page?

    Ex:-   On aspx Page Load

             ? = PatientProfile.new_historythrombosis_nce // this is pick list attribute

     

    Thanks,

    Naveen

    Friday, August 13, 2010 6:19 AM

Answers

All replies

  • you can use

    int Value=PatientProfile.new_historythrombosis_nce.Value;


    Mahain : http://mahenderpal.wordpress.com
    Friday, August 13, 2010 6:27 AM
    Moderator
  • Thanks Mahender, I will check it
    Friday, August 13, 2010 6:35 AM
  • Hi Mahender,

    Sometimes the picklist values will be null.

    So in this case how to assign null value to the integer.

     

    Thanks,

    Naveen

    Friday, August 13, 2010 12:28 PM
  • you can do like this

    string PickListVal=String.Empty;

    if(PatientProfile.new_historythrombosis_nce.Value!=null)

    PickListVal=PatientProfile.new_historythrombosis_nce.Value.ToString();

     

     


    Mahain : http://mahenderpal.wordpress.com
    • Proposed as answer by HIMBAPModerator Friday, August 13, 2010 12:32 PM
    • Marked as answer by Jim Glass Jr Friday, August 13, 2010 5:15 PM
    Friday, August 13, 2010 12:32 PM
    Moderator
  • Thanks mahender

     

    Friday, August 13, 2010 1:04 PM
  • Hi Mahender,

    I am using the CRM web service refernce in ASP.net application.

    while updating the picklist attribute i need to use the PropertyCollection.

    But I am not able to get the PropertCollection in intellisense.

    Ex:- CRMServiceProvider.CRM.WebService.?  //Here I am not able to get

     

    Thanks,

    Naveen

     

    Friday, August 13, 2010 1:58 PM
  • Please paste your code here for enquiry
    Mahain : http://mahenderpal.wordpress.com
    Friday, August 13, 2010 2:05 PM
    Moderator
  • Hi Mahender,

    You can find the below code for update method

     

    public

    static void updatePatientProfiles4(CRMServiceProvider.CRM.WebService.CrmService service, string entityname2, Guid _opportunityId, string usThrombosistype)

    {

     

    try

    {

     

    int _thrombosistypevalue = Convert.ToInt16(usThrombosistype);

    CRMServiceProvider.CRM.WebService.

    DynamicEntity dynentity = new CRMServiceProvider.CRM.WebService.DynamicEntity();

    dynentity.Name = entityname2;

    CRMServiceProvider.CRM.WebService.

    Picklist thrombosispicklistvalue = new CRMServiceProvider.CRM.WebService.Picklist();

    thrombosispicklistvalue.Value = _thrombosistypevalue;

     

     

    Guid entityguid = _opportunityId;

    CRMServiceProvider.CRM.WebService.   //Here not able to get the PropertyCollection

    properties.Add(

    new KeyProperty("opportunityid", new Key(entityguid)));

    properties.Add(

    new CRMServiceProvider.CRM.WebService.PicklistProperty("us_thrombosistype", thrombosispicklistvalue));

    dynentity.Properties = poperties;

    CRMServiceProvider.CRM.WebService.

    TargetUpdateDynamic target = new CRMServiceProvider.CRM.WebService.TargetUpdateDynamic();

    target.Entity = dynentity;

    CRMServiceProvider.CRM.WebService.

    UpdateRequest update = new CRMServiceProvider.CRM.WebService.UpdateRequest();

    update.Target = target;

    CRMServiceProvider.CRM.WebService.

    UpdateResponse updated = (CRMServiceProvider.CRM.WebService.UpdateResponse)service.Execute(update);

     

    }

     

    catch (SoapException Ex)

    {

     

    throw new Exception(Ex.Detail.InnerText.ToString());

    }

     

    Pleasse let me know if any changes require.

    Thanks,

    Naveen

    Friday, August 13, 2010 3:53 PM
    • Marked as answer by Jim Glass Jr Friday, August 13, 2010 5:15 PM
    Friday, August 13, 2010 4:29 PM
    Moderator
  • hello Mahender,

    I have got struck with the same issue..

    could you please get me the code sample to assign all the c# array list values to crm 4.0 picklist.

     

    regards,

    Raziq

    Friday, August 27, 2010 11:02 PM