rappen / BulkDataUpdater

Updates or touches single attributes on a set of records.
https://www.nuget.org/packages/Cinteros.XrmToolBox.BulkDataUpdater/
GNU General Public License v3.0
5 stars 5 forks source link

Moving value from one column to another using Bulk Data Updater #198

Closed MetaGup closed 1 year ago

MetaGup commented 1 year ago

I used the tool XRM Tokens Runner to create this: {cre64_propertyowner.fullname|}

But when I use that in the Bulk Data Updater/Update/Calculate area. Perhaps this isn't possible but if I'd be able to do this the tool would be incredibly helpful!

Thanks!


System.Exception:
Not valid format [Entity:]Guid
Bulk Data Updater
- Cinteros.XTB.BulkDataUpdater.BulkDataUpdater.<>c__DisplayClass48_0.<UpdateRecords>b__1(BackgroundWorker bgworker, DoWorkEventArgs workargs)
- System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
- System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

rappen commented 1 year ago

The error message says it needs a Guid, and perhaps an entity name also. That makes me think you try to set a lookup attribute. In that case, you should be able to do it using: {cre64_propertyowner.contactid}.

MetaGup commented 1 year ago

Thank you for your reply! I am actually trying to take the value in a lookup field and place that value in a newly created customer field.

I tried using what you suggested and received the same error as the one before I believe. I attached an image below in case that helps.

image

The only other way I can think of to do this sort of thing is exporting/reimporting the data but that's always so prone to errors and isn't nearly as simple as using your tool would be. Either way, I really appreciate the help!

Thanks!

rappen commented 1 year ago

Hi

Can you check the result in the XRM Tokens Runner? Do you get a proper guid? Note that my suggestion assumed that it was a relationship to Contact, that may not be correct.

Since the target field is a Customer, it needs info on which table (entity) the id is related to. So you can put this as the calculate: contact:{cre64_propertyowner.contactid}.

ciaomatteo commented 1 year ago

Same issue here. XRM Token Runner returns valid guid. image

rappen commented 1 year ago

Thanks @CrmDev23! Although, I don't really know if it is an issue, or if you are just showing how to do it? I don't see any problem you have, by looking at your pic.

ciaomatteo commented 1 year ago

Sorry @rappen. Here we go: image BulkDataUpdater should update a lookup value. No error is reported. But nothing is updated.

MetaGup commented 1 year ago

Hi

Can you check the result in the XRM Tokens Runner? Do you get a proper guid? Note that my suggestion assumed that it was a relationship to Contact, that may not be correct.

Since the target field is a Customer, it needs info on which table (entity) the id is related to. So you can put this as the calculate: contact:{cre64_propertyowner.contactid}.

Using the value I was initially trying, {cre64_propertyowner.fullname}, does show a full name within the XRM Tokens Runner. You are correct in that the cre64_propertyowner field has a relationship with Contact, and the value "contact:{cre64_propertyowner.contactid}" does show a guid within XRM Tokens Runner as well but it shows the result as "contact:b4691e57-c2ea-ed11-a7c6-000d3a32fe29". Testing that out on a record did actually work though so that seemed to do the trick! I was just confused thinking that the "contact:" portion of the generated value was going to be placed into the new field but that's definitely not the case.

Thanks to both of you @rappen @CrmDev23 for your help, I really really appreciate it. This is going to help me so much in my day to day!

Best, MetaGup

rappen commented 1 year ago

I'm glad we solved it! 😊 I realized now I need to improve the docs about this, exactly about <entityname>:<guid> that's needed for some relationships.

ciaomatteo commented 1 year ago

@rappen : I assume, we have to put the logical entity name there. Because in my case it's not working: image

Should we include the GUID (|<value>)? Both is not working for us.

rappen commented 1 year ago

Can you try the result in the XRM Tokens Runner tool? Try it for the same record you have selected when you got the error you sent me. Do you get a proper Guid there?

Usually |<value> is needed; it depends on the attribute type.

The entity is only needed when the relationship could be to more than one table.

ciaomatteo commented 1 year ago

Here is my result on the record in XRM Tokens Runner: image

Updating the record, results in just clearing the lookup value instead of updating: image

rappen commented 1 year ago

Sorry, I can't find any issues about this... It looks ok to me. Can you try to make the same queries in FXB, to see the relationships are really ok, that the data is really there, etc?

ciaomatteo commented 1 year ago

Thanks for taking the time. Also in FXB I don't see any updates on the lookup field. Is there somewhere a log to see the generated update queries?

rappen commented 1 year ago

Sorry... bad thing that logging is missing... 😞 I will do it. One day. See #200

ciaomatteo commented 1 year ago

Hi @rappen No problem at all! Just wonna tell you, your tools are amazing and a huge help in our daily work.

rappen commented 1 year ago

Thanks! 😊

If you feel you are saving too much time and get crazy much quality - You may sleep easier and better by going here... 😉 https://fetchxmlbuilder.com/donate or here... https://jonasr.app/bdu/donate