ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[EVENT REQUEST] Skip Confirm to avoid callback synchronizing in codeunit 5330 "CRM Integration Management"

Open jamunoz-pdw opened this issue 4 years ago • 1 comments

Hi,

Currently it's not possible to call synchronization standard functionality from a web service in order to automate integration from Dataverse to BC due to a callback. It works when inserting, but when updating.

When creating a new register from Dataverse, we're able to call CrmIntegrationMgt.CreateNewRecordsFromCRM() function and it works, but we cannot call CrmIntegrationMgt.UpdateMultipleNow() function in order to update registers because there is a Confirm message and callbacks are not allowed.

Thanks in advance

    local procedure GetSelectedMultipleSyncDirection(IntegrationTableMapping: Record "Integration Table Mapping"): Integer
    var
        SynchronizeNowQuestion: Text;
        AllowedDirection: Integer;
        RecommendedDirection: Integer;
        SelectedDirection: Integer;
    begin
        AllowedDirection := IntegrationTableMapping.Direction;
        RecommendedDirection := AllowedDirection;
        case AllowedDirection of
            IntegrationTableMapping.Direction::Bidirectional:
                begin
                    SelectedDirection := StrMenu(UpdateNowUniDirectionQst, RecommendedDirection, UpdateMultipleNowTitleTxt);
                    if SelectedDirection = 0 then
                        SelectedDirection := -1;
                    exit(SelectedDirection);
                end;
            IntegrationTableMapping.Direction::FromIntegrationTable:
                SynchronizeNowQuestion := StrSubstNo(UpdateMultipleNowFromCRMQst, CRMProductName.CDSServiceName());
            else
                SynchronizeNowQuestion := StrSubstNo(UpdateMultipleNowToCRMQst, CRMProductName.CDSServiceName());
        end;

        // START ****
        IsHandled := false;
        OnBeforeSynchronyzeNowQuestion(AllowedDirection, IsHandled);
        if IsHandled then
            exit(AllowedDirection);
        // END ****        

        if Confirm(SynchronizeNowQuestion, true) then
            exit(AllowedDirection);
        exit(-1); // user canceled the process
    end;
    [IntegrationEvent(false, false)]
    local procedure OnBeforeSynchronyzeNowQuestion(var AllowedDirection: Integer; var IsHandled: Boolean)
    begin
    end;

jamunoz-pdw avatar Dec 14 '21 12:12 jamunoz-pdw

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

JesperSchulz avatar Jan 12 '22 11:01 JesperSchulz