MS Dynamics CRM 365 - import data from Excel files - dynamics-crm

I'm getting into MS Dynamics CRM 365 programming, and have been dealing with data imports of lookup / reference entities.
I created a new entity with just the default Name column, stored and published it, and then went to look at in CRM. From the default "main" view, I choose the "Data Import" option and downloaded a template .xlsx file, which I then filled out. After that, I chose "Import Data" and uploaded this filled out .xlsx, and it was submitted, parsed, transformed successfully and the rows I had entered show up as expected.
So far, so good.
Now I created a second lookup entity (again with just the Name field), published it, and thought I'd be smart and just "re-use" that .xlsx "template" I had downloaded for the first lookup entity, and enter the new values for the second lookup entity, and then upload this manually "recycled" file. I did change the file name of the .xlsx, as well as the worksheet name, to match the name of the second lookup entity.
And while the upload, the parsing and transforming worked just fine - the actual rows I had inserted ended up in the first lookup entity...
So my conclusion is: somewhere, CRM must keep track of what entity that .xlsx was indended for - and it's neither the file name of the .xlsx, nor the name of the worksheet (which I had also updated) - it must be stored somewhere else.
Does anyone know where?? Can I change it somehow (manually or programmatically)?
After I went through the full cycle again (download import template .xlsx, fill that out, upload that file) - it works just fine for the second lookup entity, too.

There will be a hidden sheet in Excel file, but we cannot unhide it. That’s where all the configurations are stored.
But you can see it when you do something like explained in this blog, you have to click “View code” option from context menu, by right clicking sheet name tab in Excel file.
Then by opening the “Project explorer”, the hidden sheet will be visible in VBA, set the visibility to 1 – xlSheetVisible. Don’t save anything.

I believe the issue lies in the hidden first three columns, the first of which contains the entity name in the header.
When working with import templates, especially when exporting for reimport, these columns are key. The first column holds the Guid of the record, the checksum tells the system if the user touched the data in the row, and the modifiedOn allows the system to know if the data was changed in the system after the export.

Related

Power Automate issue from Microsoft Form Get Responses trigger, where email attachment File Content shows previous submission

I have created a Quality Audit in Microsoft Forms that I've Power Automated. This is the first flow i've ever built and could use some help!
After the trigger of When a new response is submitted, the flow works as follows:
Add a row into a table (this works in parallel with the Update a Row below - i'm having no issues with this step)
Update a Row in a table to act as an individual scorecard - where the table has all of the Form questions and the row updates based on the corresponding Get Response Details. Basically all submissions would use the same base Excel file in Onedrive, that has a template that shows the Get Response Details and calculates a score based on an IF formula.
Copy File saves a copy of the template scorecard to the same Onedrive folder, with a unique file name based on the Get Response Details of employee name, date, and form ID.
Get File Metadata Using Path - identical to the path of the Copy File above.
Get File Content based on the ID of the Get File Metadata.
Send an email (V2) to the manager with an attachment (using the Display Name of the Copy File & File Content).
Beginning of flow
Send email V2 flow
As for the problem, after the Form is submitted, the email attachment reflects the File Content of the previous form submission and not the current. But what I interesting is that:
The name of the file is correct based on the Copy File step.
When I look at the actual copy of the file saved to Onedrive - it's correct with all the right info. It's only the email attachment that seems to be an issue.
When I manually re-submit the trigger from the 28 Day Run History, this time the File Content of the emailed scorecard is accurate. Even when it's re-submitted seconds to minutes of the initial submission.
To try to fix:
Added in a Delay (30 seconds to 2 minutes) at various steps thinking that perhaps the flow was completing too quickly - it was copying the file and sending the emailed attachment before the system could update the table. But this had no effect.
Used different dynamic content for the Get File Metadata/Content steps. In addition to ID, I also tried by File Path, Name, & Etag. I also tried the ID of the Copy File instead of the File Metadata. These had no effect.
Did the Copy File first - meaning I saved a copy of the initial blank scorecard to a unique file name and then did Update a Row based on said copied file. But because Update a Row works can only work off one single file and does not have an option for File Path - I could only use ID of Copied File, which did not work.
Tried using Sharepoint instead of Onedrive - same deal.
Used Share Link to Web URL - but when you click the link - it also takes you to a form with the right file name, but the previous submissions file content.
Ideally I need the initial Form submission to show the right data in the emailed scorecard the first time, because I'm not going to go through and manually re-submit the trigger each time a new form is submitted.
Any help and suggestions are greatly appreciated!!

Can I have more than one attachment open at a time? Access/Oracle BLOB attachments

Good day all,
Problem: Users cant have more than one attachment open at a time.
Goal: Provide a way for users to have more than one attachment open at a time.
Set up: Win 10, MS Access Ver. 2112 (should be latest version as of post date), split FE/BE, Oracle 11g2.
Operation: Users create a record via a main form. Each entry represents a task to be carried out. The main form, contains a sub form that allows multiple attachments to be saved per record. The subform is a linked table from Oracle, connected through ODBC, and the column storing the attachments is BLOB. This functionality is working great.
Situation: Some of the processes that users carry out require management review. This means that a manager will pull up the record in Access and begin opening the attachments. Because some of the review processes require comparison of the attachments, it has become problematic because only one attachment can be open at a time.
Example: A record contains an attachment in the subform. Left click only attempts to edit the thumbnail that has been automatically placed in the field. Instead, a user will right click->document object->Open. This will open the attachment in whatever program the users desktop has associated with that file type. In this case, let's assume that the file is a MS Word doc. MS Word will open with the document. Everything functions as it should until the user right clicks on the next attachment to open it. This causes the Word doc to close, leaving MS Word open but with no document displaying.
Note: While the MS Word attachment is open, in the upper left hand corner, the words "Document Saved to this computer", with a combo next to it can be seen. Clicking the combo reveals that the document has been given a temporary name and is being temporarily held in the Word program folder in App Data.
Clunky work around: At this time, the only option for the users is to open the attachment, save it to a local folder, and repeat for each attachment. Once all the attachments are all saved, the reviewer can go about their business. This was problematic enough for users to inform me about their dissatisfaction with the functionality. I know, shocking. lol
Help!: What I'm seeking are suggestions and methods for either making it work in the way the users need or for some sort of work around, like, coding for access to gather and save all attachments to a given location.
If you read this far, thank you.

Microsoft Access unable to display image attachment (Runtime Error 2220)

I have a table called "Subsidiary Companies" where I store the names of different subsidiary companies and their corresponding company logo images as an attachment in a table.
I have a form called "invoice" where I use it to generate invoices. Whenever I select a subsidiary from a Combobox, it will change the image attachment box on my form to the one corresponding to the company selected.
After I attach the image to the table it worked. When I closed my entire access program and went back to it, it doesn't work anymore even though I did not change any codes, settings or image path. I got an error instead, "Runtime Error 2220: Microsoft Access can't open the file image.jpeg".
Here is my code to select the attachment image based on the company selected:
Me.AttachmentCompanyLogo.DefaultPicture = Me.ComboboxCompanySelection.Column(1)
Not sure where it went wrong as I am not very familiar with Access, would appreciate some help, thank you :)
based on this statement: " When I closed my entire access program and went back to it, it doesn't work anymore"
that behavior would occur if you failed to also include the primary/foreign key cross reference value in the record. such that when you next go to select it - it can't be found because when you added the image/path it also needed the key value as a cross reference...
this is just a guess of course...
look directly at the table and see if this data is missing...
on a different topic; if you have only a small quantity of images the use of attachments is ok however if there will be a larger quantity then one should not use the attachments feature and instead store the image docs in a separate folder while putting the path to the image doc in a table.

LLBLGenPro + VB6 project - accessing new columns added to a typedlist

I have a program made in Visual Basic 6 which access data from a database (made with Microsoft SQL server management studio express 2000 then migrated to 2005) and puts all data into an immense GridView.
The views, typedlists, queries, etc... all have to go through LLBLGenPro, which is used from what i learned to regenerate the entire code of our program in case we need to add anything. The project on LLBL contains entities, typedlists and typedviews. I'm not a pro of LLBLGenPro and i'm just starting to discover it
I have to add two columns to the Gridview with two specific tables columns containing the information i need. So i went onto the database to modify the view i needed to get the required data (which now gives me the two more desired rows), then i loaded the database again in LLBLGenPro and made sure to check my new fields in the typedList that contains them. I regenerated the program, and
started the visual basic project. My columns appear in all the files where they should be, with the right names (the typedlist and the views referring to it). The classes now find 23 column indexes instead of 21. All seems fine for now.
The typedList is then imported into the main class:
Private _typedList As New DBSqlTypedList.MyClassNameTypedListTypedList
All the items from the table in the DB are already loaded correctly by the code using filters and appear in the program without problem. The typedlist we need (imported as _typedList) fills the data in the gridview (GridBT) with the following lines:
If isOpenSoftware Then
With Me.gridBT
.AutoGenerateColumns = True
.AlternatingRowsDefaultCellStyle = Nothing
.DataSource = _typedList
Now here's the problem: _typedList does not see my two news rows at all and they don't appear in the grid at all.
Typing _typedList.item(0).xxxx for example gives me access to all the rows that were already there but none of the two i added appear in it.
Did I forget something in LLBLGenPro?
Don't hesitate to tell me if you think i didn't send enough code or information!

Saving copy of old table entry to another table when updating table entry with SaveChanges()?

Im working on an online store project where I have already made it possible for an administrator to update different table entries via the store gui (like items, user profiles, orders etc). SaveChanges(); is used to save the changes.
Im currently trying to figure out how to make this work:
An entry in table "items" gets updated.
Before the entry in the table "items" gets updated, a copy of the old entry gets saved into a table named "history-items".
The copy that is saved to "history-items" preferably has a timestamp.
How would I go about doing this? (As you might tell, I just recently picked up visual studio, and am pretty new to everything)
Thank you.
There are atleast 3 ways to do this:
If you are using SQL Server 2008 or newer this is now built in functionality, see: http://msdn.microsoft.com/en-us/library/bb933994.aspx
If you opt not to use that then the simplest solution is to use database triggers.
If you want to do it in C# code, then you need to read the original values before saving, and save these original values to the history table. For reading original values see: How to get original values of an entity in Entity Framework?
I would go for option 1 if possible.

Resources