Skip to main content
Business Central forum
Suggested answer

Duplicate subscription events are getting fired automatically

editSubscribe (1) ShareShare
ReportReport
Posted on by 26
HI All,
 
We are doing BC to salesforce integration. So whenever an item is created in BC through subscription API we are trying to push to SF , so subscripted to items table.
 
The problem is in the otems card when ever I add anythng in the field BC automatically saving the record and firing the event.
 
Suppose say if am entering the Product name as /Test/
 
then one event is firing for /T/ and one for /E/ and so on. But I dont want this kind of behaviour as it will increase the complexity. Once all the fields are entered then only I need the subscription event to be fired. And below is one request
 
/value/: [
{
/subscriptionId/: /1758e0fe5c66448c823480ae5a86da1a/,
/clientState/: /RegisterCustomers/,
/expirationDateTime/: /2024-02-26T21:47:18Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/customers(acb3aed2-e34f-ed11-bfc3-001dd8b71ebf)/,
/changeType/: /updated/,
/lastModifiedDateTime/: /2024-02-26T11:17:17.373Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(dd48b68e-93d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /created/,
/lastModifiedDateTime/: /2024-02-26T10:41:12.507Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(dd48b68e-93d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /updated/,
/lastModifiedDateTime/: /2024-02-26T10:42:00.747Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(dd48b68e-93d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /deleted/,
/lastModifiedDateTime/: /2024-02-26T10:42:28.97Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(b808aeca-93d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /created/,
/lastModifiedDateTime/: /2024-02-26T10:42:59.63Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(b808aeca-93d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /updated/,
/lastModifiedDateTime/: /2024-02-26T10:43:03.213Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(b808aeca-93d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /deleted/,
/lastModifiedDateTime/: /2024-02-26T10:44:32Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(05313410-95d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /created/,
/lastModifiedDateTime/: /2024-02-26T10:52:05.5Z/
},
{
/subscriptionId/: /f3abab4af53c4210a170dfe234a7a37b/,
/clientState/: /CreateProductsInSF/,
/expirationDateTime/: /2024-02-27T18:00:31Z/,
/resource/: /api/v2.0/companies(1909e69c-24f3-ec11-bfb0-001dd8b71ebf)/items(05313410-95d4-ee11-bfdf-001dd8b71ebf)/,
/changeType/: /deleted/,
/lastModifiedDateTime/: /2024-02-26T11:26:18.597Z/
}
]
}
 
 
Is there any way to resolve this ?
  • Community member Profile Picture
    Community member 17 on at
    Duplicate subscription events are getting fired automatically
    Hi,
     
    I just subscribed through
     
     
    I am not sure how to acheive with the below answer you gave. Can you guide me how to put that code into BC?
     
    Thanks
    V S
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 59,978 Super User on at
    Duplicate subscription events are getting fired automatically
    Which event did you subscribe to? For example, if the OnAfterModifyEvent of the table is used, this problem should not occur.
     
    Hope this helps.
    Thanks.
    ZHU

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,068 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,591 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans