AL icon indicating copy to clipboard operation
AL copied to clipboard

Error when generating integration table for CDS entity with altpgen.exe

Open ligoendeavor opened this issue 6 years ago • 12 comments

Describe the bug Getting "System.NullReferenceException: Object reference not set to an instance of an object." when trying to generate integrations table for CDS entity with altpgen.exe

To Reproduce

  1. Using altpgen.exe from C:\Users<user>.vscode\extensions\ms-dynamics-smb.al-5.0.280447\bin folder.
  2. Start Power Shell ISE as administrator
  3. Run script from folder above: .\altpgen -project:"C:\VSCode\CDSIntegration" -packagecachepath:"C:\VSCode\CDSIntegration\.alpackages" -serviceuri:"https://mycrm.crm4.dynamics.com" -entities:account -baseid:50500

Cache folder contains symbol files from BC 16.1.

Expected behavior A new AL file with a table extension of the account entity with the custom fields that were added in CDS.

Screenshots AL error

5. Versions:

  • AL Language: 5.0.280447
  • Business Central: Plattform 16.0.12630.13614 + App 16.1.12629.12805

ligoendeavor avatar Jun 05 '20 10:06 ligoendeavor

Update on this issue: Seems like I can generate files for custom entities but not for standard ones.

ligoendeavor avatar Jun 05 '20 15:06 ligoendeavor

Hi,

Any news about this? Still hitting exception, but now it looks different. In this new example I tried to generate file for the account entity in CE. The altpgen version is from ms-dynamics-smb.al-5.0.288712. alpackages are from BC 16.3.

altpgen.exe -project 'C:\VSCode\CDSIntegration' -packagecachepath 'C:\VSCode\CDSIntegration.alpackages' -serviceuri 'https://mycrm.crm4.dynamics.com' -entities account -baseid 50500

image

ligoendeavor avatar Jul 08 '20 09:07 ligoendeavor

Hello,

i have exactly the same issue, excepti using BC Version 16.3.14085.14363, everything behaves sames. I already tested it with a CDX Demo Enviroment and it's work very well, but on another targeted enviroment i get the same error, too.

My guess is that i maybe have insufficient permissions on the enviroment?

@ligoendeavor Could you solve this problem?

sduepmann avatar Jul 23 '20 15:07 sduepmann

Hello,

Is there any update regarding this issue. I am struck, could not find any solution

CChub402 avatar Jul 30 '20 09:07 CChub402

@ChronosBerlin no, haven't solved this...

ligoendeavor avatar Aug 10 '20 08:08 ligoendeavor

Hi, could you please send the metadata of your CDS table 'account'? You can get it by two calls to CRM API: environmenturl/api/data/v9.1/EntityDefinitions(LogicalName='account') and environmenturl/api/data/v9.1/EntityDefinitions(LogicalName='account')/Attributes

onbuyuka avatar Aug 11 '20 14:08 onbuyuka

@onbuyuka Attached files from both calls. Thank you!

Metadata1.txt

Metadata2.txt

ligoendeavor avatar Aug 12 '20 06:08 ligoendeavor

Seems like the problem is solved with the latest AL-language (altpgen.exe) in VS Code. I'm now for instance able to generate file for the account entity.

ligoendeavor avatar Aug 24 '20 09:08 ligoendeavor

I'm now using the altpgen.exe from this folder: C:\Users<user>.vscode\extensions\ms-dynamics-smb.al-5.0.320540\bin

ligoendeavor avatar Aug 24 '20 09:08 ligoendeavor

It is great to hear the bug got resolved. I'll close the issue and if you find another bug just open a new issue. Thanks for reporting it.

thpeder avatar Aug 28 '20 06:08 thpeder

Hello guys, I'm sorry for reopening this thread. Do you know if it is possible to do this with standard tables? I mean, I'd like to do somthing like this:

.\altpgen -project:"C:\VSCode\CDSIntegration" -packagecachepath:"C:\VSCode\CDSIntegration.alpackages" -serviceuri:"https://mycrm.crm4.dynamics.com" -entities:serviceitems -baseid:5940

Is it possible? If it isn't... is the alternative to create a duplicate table of Service Item table (5940) and then clone every insert/modify/delete data from 5940 table to a 50100 new one?

Thank you

deadmouse avatar Sep 09 '20 11:09 deadmouse

@deadmouse Yes, you can use the alptgen tool with standard tables too.

onbuyuka avatar Sep 30 '20 11:09 onbuyuka