locked
Execute Multiple Request with Key Attribute Collection RRS feed

  • Question

  • Hi,

    I am using Execute Multiple Request with Key Attribute Collection to bulk Upsert in CRM. I have a question regarding the KeyAttributeCollection side of things. I want to be able to the following type of record comparison:

    The bold texts are attributes in CRM.

    if(accountnumber = customerid[i]) then update else if (prospcustid = glaccid) then update else insert the record.

    How do I implement the above logic by using the KeyAttributeCollection class? I know you can add attributes to the AttributeCollection but, is there a way I can do record comparison like the above?

    Thanks,

    Shishir

    Monday, October 31, 2016 8:24 PM

Answers

  • I'm fairly sure you can't implement this logic in one Upsert request. Instead, you'll need to do one comparison in your code, and the other via Upsert.

    I think the simplest logic would be:

    In your code, compare the accountnumber. For those that match, do an Update, for those that don't, do an Upsert based on propcustid


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Tuesday, November 1, 2016 11:03 AM
    Moderator

All replies

  • I'm fairly sure you can't implement this logic in one Upsert request. Instead, you'll need to do one comparison in your code, and the other via Upsert.

    I think the simplest logic would be:

    In your code, compare the accountnumber. For those that match, do an Update, for those that don't, do an Upsert based on propcustid


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Tuesday, November 1, 2016 11:03 AM
    Moderator
  • I guess that'll be the best approach in this situation. The whole one to one record comparison in CRM is hurting the performance.

    Thanks a lot!

    Tuesday, November 1, 2016 8:45 PM