web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Error Creating Custom Profile from with AL business central

(1) ShareShare
ReportReport
Posted on by 57

Hello everyone,

I’m working on Business Central v27 (cloud), and I’m trying to create a custom profile programmatically from the existing ‘RAPIDSTART SERVICES’ profile using an Install Codeunit.

Here’s the code I’m using:

When I run this, I get the following error:

 

The profile with the ID 'IFTAM' and AppId '{xxxx-xxx-xx-xxx}' cannot be created, because the specified AppId is different from the empty GUID.

And another question is profile.Copy(profileRapidStart); gonna do the same as the button "copy profile.." :
I have the same question (0)
  • Suggested answer
    Gregory Mavrogeorgis Profile Picture
    342 on at
    Error Creating Custom Profile from with AL business central
    Hi,

    You’re getting that error because you’re inserting a new record with the same non-empty AppId as the source profile (“RAPIDSTART SERVICES” comes from the Base App).

    Business Central won’t let your extension create a profile that is “owned” by another app. Profiles you create at runtime must be tenant customizations → i.e., the App ID must be empty (all zeros) and “Published As” must be Tenant Customization.

     Read from All Profile, insert into Profile and clear the app fields

    codeunit 90902 "IFTAM Install"
    {
        trigger OnRun()
        begin
            CreateProfile();
        end;
        procedure CreateProfile()
        var
            SrcAllProfile: record "All Profile";
            NewProfile:    record Profile;
        begin
            if SrcAllProfile.Get('RAPIDSTART SERVICES') then begin
                NewProfile.Init();
                // copy the bits you want from the source
                NewProfile.Validate("Profile ID", 'IFTAM2');
                NewProfile.Validate(Description, 'Profile for IFTAM Integration');
                NewProfile.Validate("Role Center ID", SrcAllProfile."Role Center ID");
                NewProfile."Disable Personalization" := SrcAllProfile."Disable Personalization";
                // VERY IMPORTANT: make it a tenant customization (no app ownership)
                Clear(NewProfile."App ID");
                NewProfile."App Name" := '';
                NewProfile."Extension Name" := '';
                NewProfile."Published As" := NewProfile."Published As"::"Tenant Customization";
                NewProfile.Insert(true);
            end;
        end;
    }
    Notes:
     

    Use “All Profile” only to read an existing profile (it’s a union over app/tenant profiles).

    • Insert the new record into “Profile” (the insertable table).

    • Clearing "App ID" (and related fields) and setting "Published As" is what resolves the error.

     
    If you have found it useful please mark it as verified

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,828

#2
Sumit Singh Profile Picture

Sumit Singh 2,617

#3
YUN ZHU Profile Picture

YUN ZHU 1,861 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans