Then there is custom route on the REST API called Inventory Master Catalogue that can be called either directly or can fire with a double hop off an inventory web hook.
What the customer now wants to have happen is that if an inventory item is added or deleted from IN_WebCategoriesInventory through the screen that an update will fire a web hook to send the data to the external system as an inventory update seeing the web categories are sent as part of the catalogue data.
The only way I can think to do this is via the following:
1. On the Collection Item(IN_WebCategoriesInventory) iSave add an event that can be attached to like a save end.
2. In a business logic plugin attach to this event and have a new custom web hook fire and call a custom route on the api that will again get the catalogue information together and forward it on to the external system.
Could there be a simpler way to do this that I haven't though of as this starting to do my head in?
- Code: Select all
CREATE TABLE [dbo].[IN_WebCategoriesMain](
[RecID] [uniqueidentifier] NOT NULL,
[Category1] [varchar](255) NOT NULL,
[Category2] [varchar](255) NOT NULL,
[Category3] [varchar](255) NOT NULL,
[Enabled] [bit] NOT NULL,
[LastUpdated] [datetime] NULL,
[CatGrp] [varchar](255) NOT NULL,
CONSTRAINT [PK_IN_WebCategoriesMain] PRIMARY KEY CLUSTERED
(
[RecID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[IN_WebCategoriesInventory] Script Date: 20/04/2021 3:55:07 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[IN_WebCategoriesInventory](
[RecID] [uniqueidentifier] NOT NULL,
[IN_WebCategoriesMain_RecID] [uniqueidentifier] NOT NULL,
[InventoryID] [char](20) NOT NULL,
[Enabled] [bit] NOT NULL,
[LastUpdated] [datetime] NOT NULL,
CONSTRAINT [PK_IN_WebCategoriesInventory] PRIMARY KEY CLUSTERED
(
[RecID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[IN_WebCategoriesInventory] WITH CHECK ADD CONSTRAINT [FK_IN_WebCategoriesInventory_IN_Main] FOREIGN KEY([InventoryID])
REFERENCES [dbo].[IN_Main] ([InventoryID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[IN_WebCategoriesInventory] CHECK CONSTRAINT [FK_IN_WebCategoriesInventory_IN_Main]
GO
ALTER TABLE [dbo].[IN_WebCategoriesInventory] WITH CHECK ADD CONSTRAINT [FK_IN_WebCategoriesInventory_IN_WebCategoriesMain] FOREIGN KEY([IN_WebCategoriesMain_RecID])
REFERENCES [dbo].[IN_WebCategoriesMain] ([RecID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[IN_WebCategoriesInventory] CHECK CONSTRAINT [FK_IN_WebCategoriesInventory_IN_WebCategoriesMain]
GO