Skip to content

Commit

Permalink
[24X][Copilot] Marketing Text Improvements - Functions and GPT4o (#1570)
Browse files Browse the repository at this point in the history
#### Summary

Improvements done to marketing text feature by introduction functions
and upgrading the model to gpt4o. The changes were merged into main as
part of this PR #1275

This PR backports this change into 24.x

-  #1275 

#### Work Item(s) 

Fixes #
[AB#521281](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/521281)

---------

Co-authored-by: Dmitry Katson <dmitry.katson@gmail.com>
Co-authored-by: Qasim Ikram <qaikram@microsoft.com>
  • Loading branch information
3 people authored Jul 16, 2024
1 parent bf716f3 commit 0ba1b86
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 151 deletions.
10 changes: 8 additions & 2 deletions src/System Application/App/Entity Text/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
"name": "Upgrade Tags",
"publisher": "Microsoft",
"version": "24.4.0.0"
},
{
"id": "de35f591-7216-4e60-8be1-1911d71a7fc2",
"name": "Telemetry",
"publisher": "Microsoft",
"version": "24.4.0.0"
}
],
"internalsVisibleTo": [],
Expand All @@ -85,8 +91,8 @@
"idRanges": [
{
"from": 2010,
"to": 2015
"to": 2018
}
],
"contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ codeunit 2010 "Entity Text"
/// <param name="EntityTextContent">The new entity text content.</param>
procedure UpdateText(var EntityText: Record "Entity Text"; EntityTextContent: Text)
var
TelemetryCategoryLbl: Label 'Entity Text', Locked = true;
TelemetryUpdateRecordTxt: Label 'Updating text on record for table %1 and scenario %2.', Locked = true, Comment = '%1 the table id, %2 the scenario id';
begin
Session.LogMessage('0000JVL', StrSubstNo(TelemetryUpdateRecordTxt, Format(EntityText."Source Table Id"), Format(EntityText.Scenario)), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', TelemetryCategoryLbl);
Session.LogMessage('0000JVL', StrSubstNo(TelemetryUpdateRecordTxt, Format(EntityText."Source Table Id"), Format(EntityText.Scenario)), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', EntityTextImpl.GetFeatureName());
EntityTextImpl.SetText(EntityText, EntityTextContent);
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ page 2011 "Entity Text Factbox Part"
procedure SetContext(SourceTableId: Integer; SourceSystemId: Guid; SourceScenario: Enum "Entity Text Scenario"; PlaceholderText: Text)
var
EntityTextRec: Record "Entity Text";
EntityTextImpl: Codeunit "Entity Text Impl.";
begin
HasContext := false;

Expand Down Expand Up @@ -167,7 +168,7 @@ page 2011 "Entity Text Factbox Part"

CurrPage.Update(false);

Session.LogMessage('0000JVC', StrSubstNo(TelemetrySetContextTxt, Format(SourceTableId), Format(SourceScenario), Format(CallerModuleInfo.Id()), CallerModuleInfo.Publisher()), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', TelemetryCategoryLbl);
Session.LogMessage('0000JVC', StrSubstNo(TelemetrySetContextTxt, Format(SourceTableId), Format(SourceScenario), Format(CallerModuleInfo.Id()), CallerModuleInfo.Publisher()), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', EntityTextImpl.GetFeatureName());
end;

local procedure OpenEditPage(SourceAction: Enum "Entity Text Actions")
Expand All @@ -192,11 +193,11 @@ page 2011 "Entity Text Factbox Part"
EntityTextCod.OnEditEntityTextWithTriggerAction(TempEntityText, EditAction, Handled, SourceAction);

if not Handled then begin
Session.LogMessage('0000LJ4', StrSubstNo(TelemetryNoEditPageTxt, Format(CurrentTableId), Format(CurrentScenario)), Verbosity::Error, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', TelemetryCategoryLbl);
Session.LogMessage('0000LJ4', StrSubstNo(TelemetryNoEditPageTxt, Format(CurrentTableId), Format(CurrentScenario)), Verbosity::Error, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', EntityTextImpl.GetFeatureName());
Error(NoHandlerErr);
end;

Session.LogMessage('0000JVB', StrSubstNo(TelemetryEditHandledTxt, Format(Handled), Format(EditAction)), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', TelemetryCategoryLbl);
Session.LogMessage('0000JVB', StrSubstNo(TelemetryEditHandledTxt, Format(Handled), Format(EditAction)), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, 'Category', EntityTextImpl.GetFeatureName());

if EditAction in [Action::LookupOK, Action::OK] then begin
EntityTextImpl.InsertSuggestion(CurrentTableId, CurrentSystemId, CurrentScenario, EntityTextImpl.GetText(TempEntityText));
Expand Down Expand Up @@ -239,7 +240,6 @@ page 2011 "Entity Text Factbox Part"
NotEnabledPlaceholderTxt: Label 'Select Edit to add text', Comment = 'Edit refers to an action on this part with the same name';
DefaultPlaceholderTxt: Label '[Create text](). Then review and edit based on your needs.', Comment = 'Text contained in [here]() will be clickable to invoke the suggest action';
ContextNotSetErr: Label 'The context has not been set on the part. Ensure SetContext has been called from the parent page, contact your partner to fix this.';
TelemetryCategoryLbl: Label 'Entity Text', Locked = true;
NoHandlerErr: Label 'There was no handler to provide an edit page for this entity. Contact your partner.';
TelemetryNoEditPageTxt: Label 'No custom page was specified for edit by partner: table %1, scenario %2.', Locked = true;
TelemetryEditHandledTxt: Label 'Edit result was handled: %1, with action %2.', Locked = true;
Expand Down
Loading

0 comments on commit 0ba1b86

Please sign in to comment.