Open Closed

How to override organization unit UI(Create&Edit)? #1921


User avatar
0
Shoba24 created
  • ABP Framework version: v4.4.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi,

we have added state entity to organization unit by referring this https://support.abp.io/QA/Questions/295/Extending-Abp-entities-by-adding-navigation-properties

Now we want to override organization unit create/edit page to display StateLookupList ?


10 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi,

    I think you can do it by following this document.

    I just created a test project and did what you are trying to do by following the document:

  • User Avatar
    0
    Shoba24 created

    Yes we also already tried this ,we get internal error on post.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Can you share the relevant logs?

  • User Avatar
    0
    Shoba24 created

    2021-09-30 14:55:57.166 +05:30 [INF] Request starting HTTP/2 GET https://localhost:44395/Identity/OrganizationUnits/CreateModal - - 2021-09-30 14:55:57.198 +05:30 [INF] Authorization was successful. 2021-09-30 14:55:57.199 +05:30 [INF] Executing endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:55:57.204 +05:30 [INF] Route matched with {page = "/Identity/OrganizationUnits/CreateModal", action = "", controller = "", area = ""}. Executing page /Identity/OrganizationUnits/CreateModal 2021-09-30 14:55:57.204 +05:30 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2021-09-30 14:55:57.212 +05:30 [INF] Executing handler method CustomApp.Web.Pages.Identity.OrganizationUnits.CreateModalModel.OnGetAsync - ModelState is "Valid" 2021-09-30 14:55:57.221 +05:30 [INF] Start processing HTTP request GET "https://localhost:44356/api/app/states/state-lookup?SkipCount=0&MaxResultCount=1000&api-version=1.0" 2021-09-30 14:55:57.221 +05:30 [INF] Sending HTTP request GET "https://localhost:44356/api/app/states/state-lookup?SkipCount=0&MaxResultCount=1000&api-version=1.0" 2021-09-30 14:55:57.485 +05:30 [INF] Received HTTP response headers after 263.966ms - 200 2021-09-30 14:55:57.485 +05:30 [INF] End processing HTTP request after 264.1222ms - 200 2021-09-30 14:55:57.502 +05:30 [INF] Executed handler method OnGetAsync, returned result . 2021-09-30 14:55:57.502 +05:30 [INF] Executing an implicit handler method - ModelState is "Valid" 2021-09-30 14:55:57.502 +05:30 [INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. 2021-09-30 14:55:57.644 +05:30 [INF] Executed page /Identity/OrganizationUnits/CreateModal in 440.066ms 2021-09-30 14:55:57.644 +05:30 [INF] Executed endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:55:57.645 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44395/Identity/OrganizationUnits/CreateModal - - - 200 - text/html;+charset=utf-8 479.8264ms 2021-09-30 14:55:57.972 +05:30 [INF] Request starting HTTP/2 GET https://localhost:44395/Themes/Lepton/Global/assets/fonts/poppins-v6-latin-100.woff2 - - 2021-09-30 14:55:57.974 +05:30 [INF] The file /Themes/Lepton/Global/assets/fonts/poppins-v6-latin-100.woff2 was not modified 2021-09-30 14:55:57.974 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44395/Themes/Lepton/Global/assets/fonts/poppins-v6-latin-100.woff2 - - - 304 - font/woff2 1.8371ms 2021-09-30 14:57:00.944 +05:30 [INF] Request starting HTTP/2 POST https://localhost:44395/Identity/OrganizationUnits/CreateModal application/x-www-form-urlencoded;+charset=UTF-8 314 2021-09-30 14:57:00.976 +05:30 [INF] Authorization was successful. 2021-09-30 14:57:00.976 +05:30 [INF] Executing endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:57:00.976 +05:30 [INF] Route matched with {page = "/Identity/OrganizationUnits/CreateModal", action = "", controller = "", area = ""}. Executing page /Identity/OrganizationUnits/CreateModal 2021-09-30 14:57:00.976 +05:30 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2021-09-30 14:57:01.010 +05:30 [INF] Executing handler method CustomApp.Web.Pages.Identity.OrganizationUnits.CreateModalModel.OnPostAsync - ModelState is "Valid" 2021-09-30 14:57:01.041 +05:30 [ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }

    2021-09-30 14:57:01.044 +05:30 [ERR] Missing type map configuration or unsupported mapping.

    Mapping types: Object -> OrganizationUnitCreateDto System.Object -> Volo.Abp.Identity.OrganizationUnitCreateDto AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

    Mapping types: Object -> OrganizationUnitCreateDto System.Object -> Volo.Abp.Identity.OrganizationUnitCreateDto at lambda_method2159(Closure , Object , OrganizationUnitCreateDto , ResolutionContext ) at Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider.Map[TSource,TDestination](Object source) at Volo.Abp.ObjectMapping.DefaultObjectMapper.AutoMap[TSource,TDestination](Object source) at Volo.Abp.ObjectMapping.DefaultObjectMapper.Map[TSource,TDestination](TSource source) at CustomApp.Web.Pages.Identity.OrganizationUnits.CreateModalModel.OnPostAsync() in E:\Backup\CustomApp\src\CustomApp.Web\Pages\Identity\OrganizationUnits\CreateModal.cshtml.cs:line 56 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() 2021-09-30 14:57:01.049 +05:30 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'. 2021-09-30 14:57:01.051 +05:30 [INF] Executed page /Identity/OrganizationUnits/CreateModal in 74.9738ms 2021-09-30 14:57:01.051 +05:30 [INF] Executed endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:57:01.051 +05:30 [INF] Request finished HTTP/2 POST https://localhost:44395/Identity/OrganizationUnits/CreateModal application/x-www-form-urlencoded;+charset=UTF-8 314 - 500 - application/json;+charset=utf-8 107.1342ms

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Your problem is that OrganizationUnitCreateDto also doesn't have a State property. I suspect that you have not configured State in MyProjectNameModuleExtensionConfigurator under the MyProjectName.Domain.Shared project.

    Once you do this and you won't need to override the Create and Edit modal. When you run the application, you will be greeted with a picture like the one below:

    PS: Make sure that the code in the picture below is in MyProjectNameEfCoreEntityExtensionMappings under the EntityFrameworkCore folder in the MyProjectName.EntityFrameworkCore project and that the property you added in the AbpOrganizationUnits table of your database is added as a column.

  • User Avatar
    0
    Shoba24 created

    Hi berkansasmaz,

    As u mentioned ,we already add one extra property ADDRESS to organization unit

    Now we want to add navigation property STATE to ORGANIZATION UNIT

    I referred this ticket https://support.abp.io/QA/Questions/295/Extending-Abp-entities-by-adding-navigation-properties to add STATE to ORGANIZATION UNIT

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    First of all, I will write down the actions you have done before to be on the same page:

    1. AbpOrganizationUnits has StateId
    2. You have an entity named State and you have a property called Name(or a different property).
    3. State entity has ApplicationService and when you run MyProjectName.HttpApi.Host project, api end-points appear on swagger.
    4. When you run the MyProjectName.Web project, the same api end-points appear on swagger here too. If it is not visible, you need to create a controller in MyProjectName.Web.

    I assume you did these steps :)

    Then you can customize the ConfigureExtraProperties method of MyProjectNameModuleExtensionConfigurator under MyProjectName.Domain.Shared as in the picture below.

    I hope that you will finally see an user interface like the screenshot below:

    For more information see here.

  • User Avatar
    0
    Shoba24 created

    Thanks..Working fine!

  • User Avatar
    0
    Shoba24 created

    Hi berkansasmaz,

    Again not working...state dropdown not listing values..

    But API returns a value

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Can you share the relevant logs in MyProjectName.HttpApi.Host and MyProjectName.Web? And I would be very happy if you could share the details of the request sent over the network.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35