Skip to main content

Previous Value – How to Respond to a Change

Reaction to Change Feature

Written by Lenka Haringerová

The system has a built-in ability to react to changes, which can also be triggered from an external system. This feature is typically used in combination with ?dry-run=true in cases where you are exposing data to users for direct editing. For example, a user expects that if they change the company code on an invoice, the company name will be updated accordingly. However, the company name must also be present in the form so the user can modify it manually. The previous value can be used to define how the system should react to such a change. Multiple previous values can be included in a single request.

Example:

<?xml version="1.0"?><winstrom version="1.0">  <faktura-vydana id="123">    <firma previousValue="code:JINA FIRMA">code:FIRMA</firma>    <nazFirmy>Jin&#xE1; firma</nazFirmy>  </faktura-vydana></winstrom>

The response will then be:

<?xml version="1.0"?><winstrom version="1.0">  <faktura-vydana id="123">    <firma>code:FIRMA</firma>    <nazFirmy>Firma</nazFirmy>  </faktura-vydana></winstrom>

If no previous value were provided, the response would look like this:

<?xml version="1.0"?><winstrom version="1.0">  <faktura-vydana id="123">    <firma>code:FIRMA</firma>    <nazFirmy>Jin&#xE1; firma</nazFirmy>  </faktura-vydana></winstrom>

If you wanted to achieve the same effect without specifying a previous value, you would need to omit the attributes related to the changed attribute. This would require you to know all the dependencies that also rely on the current data.

For example, if you change the document type but the posting rule remains unchanged, the accounting entries (debit and credit) will not be overwritten. In other words, the change-reaction process is triggered only when an actual change has occurred.

In JSON format, the value is provided as an additional tag named firma-previousValue.

Did this answer your question?