RE: PostCustomerAddTrigger is not working while adding customer to transaction
Hi Pankaj,
Yes, it doesn't work for number of years and till now. We can handle it by using the "PostOperationTrigger" for the same affect and it should help out.
Here is sample solution for it.
Please do test based on your needs
import * as Triggers from "PosApi/Extend/Triggers/OperationTriggers";
import { ObjectExtensions, StringExtensions} from "PosApi/TypeExtensions";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
export default class PostOperationTrigger extends Triggers.PostOperationTrigger {
/**
* Executes the trigger functionality.
* @param {Triggers.IPostCustomerAddTriggerOptions} options The options provided to the trigger.
*/
public execute(options: Triggers.IPostOperationTriggerOptions): Promise<void> {
if (ObjectExtensions.isNullOrUndefined(options) === false) {
let operationId: ProxyEntities.RetailOperation = options.operationRequest.operationId;
let isPostSetCustomerOperation: boolean = operationId === ProxyEntities.RetailOperation.SetCustomer;
if (isPostSetCustomerOperation == true) {
//do your logic here...
}
return Promise.resolve();
}
return Promise.resolve();
}