Creating a .NET screen for a new entity record

I've got Sage 2020 R2 installed. I've installed the .NET SDK. It's added the example projects to the Visual Studio 2017. I've got 2019 installed as well but I can use either. I created a new entity called Consignments using the entity wizard. I did create it initially as a .NET component, but I recreated it as a standard one so I can just alter the pages as needed for get them to run the .NET code. At least this way I can do either. Anyway, I have a new tab in My CRM with the consignments list. There is a new button on there which calls the new custom DLL. I created a .NET project using the Sage CRM Entity template as this seems to be the one I should use when I am dealing with a custom entity. The trouble is I can't find any examples of creating a project for a custom entity. I thought there was an example .NET project of the Project entity. I can't seem to find it. I Having examples of code that show the structure of the build contents methods are really handy.

Any help would be greatly appreciated otherwise I will end up having to go back to dusting off the ASP skills again!

Thanks

  • 0

    There should be two new project templates available to you.

    'Basic' and 'Entity'

    Provided C# templates (sagecrm.com)

    The Entity Template should prompt you for the name of the entity, its prefix and primary key name.  The classes that it creates gives examples of how to code the different pages to support a custom entity.  It assumes that you have created the entity using the Advanced Customization Wizard (with the .NET flag set).

  • 0 in reply to Sage CRM

    I used the Entity template and I went through that. It's given me the stub code. I can compile and run it. I just don't know where to go from there in terms of what I do with the code. In Base.cs in the AppFactory class, the methods to call the various Run methods in the generated classes are there. I can compile this and put in Debugger.Launch() code in place to activate the JIT debugger and step through the live code. This runs the constructor in each class and then the overridden BuildContents method is called. After that I am not sure what to do.

    Ticking the "For .NET" option just means that the ASP pages don't get created at all, and the custom dot net DLL and custom ID fields, and method names get filled in on the appropriate list links. I can easily create the ASP equivalent and then alter what I need. to make it run the .NET code I have created using the template. It's once I have created the entity template. Are there any examples of a project created using the entity template?

    So, I have my Consignments entity created using the wizard. I have that already. I created a project using the entity template. I go into the admin screen and customise the new entity, I choose screens, and edit the consignmentsnewentry. This is the screen that will appear when I click on New Consignment. If I go into VS project and open the Base.cs there is a method call called RunDataPageNew which is what is called when I click on the button. This creates a new object of type ConsignmentDataPageNew which has a constructor and an override of BuildContents.

    What I'm looking for is some help in what to put in BuildContents. I call GetTabs(), that's about all I can find. I just don't know where to start looking for help and how you develop CRM stuff in C#. I code C# no problem but I am not familiar with the CRM API and so I was hoping to get some assistance one where to start, with maybe some simple examples to show the general basics of building pages using .NET.

  • 0 in reply to Vega

    I know the developer help is there but that gives me the reference. That's fine and will be useful once I have started to build my pages. None of the example templates I've found show the entity template and how to get started. Once I get going the developer help will be invaluable.

  • 0 in reply to Sage CRM

    Ok, getting somewhere now. Found some very old examples of your code which have a little of what I need. Even though the stuff is deprecated, I work out the newer code. I'll report back when I get further.

  • 0 in reply to Vega

    Hi Vega

    I've been on holiday so excuse the late response.

    The SDK contains several project that demonstrate how to use the API in anger.

    https://help.sagecrm.com/on_premise/en/2021R2/Dev/Content/Developer/DN_.NetApplications.htm

    These mostly use the Basic Template as that assumes the developer wants to do most of the work.  The Entity Template will generate a set of specialised classes that show how they work.

    I've written quite a bit about using the specialised classes

    (+) Search - Sage City Community

  • 0 in reply to Sage CRM

    Hi Jeff.

    Thanks. My assumption is that when I create a new entity, I use the entity wizard as normal, and when I create the new entity, I tick the box for dot net and it creates the metadata entries I need for it. I then load VS and choose the entity template and follow the wizard and generate the skeleton structure for the project. I'm making progress on it. To clarify, the basic template is used for standard screens and extensions, and the entity template is used when you have created a ne.

  • 0 in reply to Vega

    Generally yes.