Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Unanswered

Extension Not Loaded

(1) ShareShare
ReportReport
Posted on by 419
Hi All,
i'm new to store commerce extension 
I'm trying to open a new HTML form before adding a customer to the cart, i did the following 
  •  Created an HTML form,
  • Create Typescript module
  • extended PreCustomerSetTrigger 
  • updated manifest file
but the extension not loaded and showing below error 
 
Failed to fetch Instantiating https://local.storecommerce.dynamics.com/Create/Dialogs/EnterCustomerContactDialogs/EnterCustomerContactModule Loading https://extensions.local.storecommerce.dynamics.com/UCCustomerContact/Extend/Triggers/BeforeAddingCustomerToCartTrigger.js Loading
 
PreSetCustomer Extension code
------------------------------------
import { IPreCustomerSetTriggerOptions, PreCustomerSetTrigger } from "PosApi/Extend/Triggers/CustomerTriggers";
import { ClientEntities } from "PosApi/Entities";
import DialogSampleModule from "Create/Dialogs/EnterCustomerContactDialogs/EnterCustomerContactModule"
export default class AfterAddingCustomerToCart extends PreCustomerSetTrigger {
    public execute(options: IPreCustomerSetTriggerOptions): Promise<ClientEntities.ICancelable> {
        return new Promise((resolve, reject) => {       
            let dialogSampleModule: DialogSampleModule = new DialogSampleModule();
            dialogSampleModule.open();                        
            //const result = "Operation completed successfully";
            //alert(result);            
            const cancelableResult: ClientEntities.ICancelable = {
                canceled: false 
            };            
            resolve(cancelableResult);
        });
    }
}
 
 
EnterCustomerContactModule
----------------------------------
import * as Dialogs from "PosApi/Create/Dialogs";
import { ObjectExtensions } from "PosApi/TypeExtensions";
import { ISampleDialogResult } from "Create/Dialogs/EnterCustomerContactDialogs/IDialogSampleResult";
import ko from "knockout";
type DialogResolve = (value: ISampleDialogResult) => void;
type DialogReject = (reason: any) => void;
export default class DialogSampleModule extends Dialogs.ExtensionTemplatedDialogBase {
    public userEnteredValue: ko.Observable<string>;    
    private _resolve: DialogResolve;
    constructor() {
        super();
        this.userEnteredValue = ko.observable("");
    }
    public onReady(element: HTMLElement): void {
        ko.applyBindings(this, element);
    }
    public open(): Promise<ISampleDialogResult> {
        let promise: Promise<ISampleDialogResult> = new Promise((resolve: DialogResolve, reject: DialogReject) => {
            this._resolve = resolve;
            let option: Dialogs.ITemplatedDialogOptions = {
                title: "Create Customer Contact",
                button1: {
                    id: "btnCreate",
                    label: "Create Customer Contact",
                    isPrimary: true,
                    onClick: this.btnUpdateClickHandler.bind(this)
                },
                button2: {
                    id: "btnCancel",
                    label: "Create Customer Contact",
                    onClick: this.btnCancelClickHandler.bind(this)
                },
                onCloseX: () => this.btnCancelClickHandler()
            };
            this.openDialog(option);
        });
        return promise;
    }
    private btnUpdateClickHandler(): boolean {
        this.resolvePromise("Success");
        return true;
    }
    private btnCancelClickHandler(): boolean {
        this.resolvePromise(null);
        return true;
    }
    private resolvePromise(result: string): void {
        if (ObjectExtensions.isFunction(this._resolve)) {
            this._resolve(<ISampleDialogResult>{
                selectedValue: result
            });
            this._resolve = null;
        }
    }
}
 
 
 
Categories:

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans