Steps to reproduce:
1) Create a schema called barcode:
2) Create a document type a called box:
- Extends: collection
- Associated schemas: barcode
3) Create an automation chain called AC_Box_Barcode to initialize some properties of the document:
- Fetch > Context.FetchDocument
- Execution context > Context.SetVar
- name: barcodeID
- value: @{java.lang.String.format("%010d", java.lang.Integer.parseInt(Fn.getNextId("BoxBarCodeID") ) )}
- Document > Document.Update
- properties: dc:title=@
{Context["barcodeID"]} bc:barcodeID=@{Context["barcodeID"]}
- save: false
4) Create an Event handler definition:
- Events: Empty document created
- Event handler activation:
- Current document has one of the types: box
- Current document has facet: Any
- Current document is: Regular Document
- Event handler execution:
- Select an existing automation chain: AC_Box_Barcode
5) Deploy your changes
6) Create a new document
The automation chain is called 2 times:
- When you click on the document type icon
- When you click on the CREATE button
So, the ID is incremented in 2 units instead 1 as is expected.
NOTE: Nuxeo 10.2 used in this test
NOTE 2: To see that the event is fired twice you can replace the automation chain call for this automation script called AS_Box_Barcode which provides the same feature but adding some logs:
function run(input, params) {
Console.log("--- AS_Box_Barcode ");
var id = Fn.getNextId("BarCodeId");
Console.log("\t id:" + id);
input = Document.Update(
input, {
'properties': "dc:title=" + id + "\nbc:barcodeID=" + id ,
'save': false
}
);
return input;
}
This is the logs when you create a new document (onlye one). You can see the automation script has been called twice:
2019-01-16 10:09:55,742 WARN [http-nio-0.0.0.0-8080-exec-13] [org.nuxeo.automation.scripting.helper.Console] [LOG] --- AS_Box_Barcode
2019-01-16 10:09:55,751 WARN [http-nio-0.0.0.0-8080-exec-13] [org.nuxeo.automation.scripting.helper.Console] [LOG] id:7
2019-01-16 10:10:06,190 WARN [http-nio-0.0.0.0-8080-exec-7] [org.nuxeo.automation.scripting.helper.Console] [LOG] --- AS_Box_Barcode
2019-01-16 10:10:06,199 WARN [http-nio-0.0.0.0-8080-exec-7] [org.nuxeo.automation.scripting.helper.Console] [LOG] id:8
2019-01-16 10:12:14,438 INFO [http-nio-0.0.0.0-8080-exec-15] [org.nuxeo.runtime.reload.ReloadComponent] Before updating Nuxeo server
- is caused by
-
NXP-23141
Initialize complex fields within complex fields in doc creation in web ui errors
-
-
Resolved
There are no comments yet on this issue.
{"report":{"apdex":0.5,"isInitial":true,"journeyId":"befca39f-ba27-4fc8-af33-6a9859e45b40","key":"jira.project.issue.view-issue","navigationType":0,"readyForUser":2572.5,"redirectCount":0,"resourceLoadedEnd":1992.5,"resourceLoadedStart":698.5,"resourceTiming":[{"duration":159.89999997615814,"initiatorType":"link","name":"https://jira.nuxeo.com/s/6a73f5d78dec2c95666c7e7c8498f8b8-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/3ea23cdeead70fbb915b7e17c50e42c1/_/download/contextbatch/css/_super/batch.css?spectrum=true","startTime":698.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":698.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":858.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":160,"initiatorType":"link","name":"https://jira.nuxeo.com/s/9f346cd4cbe5c55024f573ebd1c6ef22-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/97fb1ec5d0b5277162c4e1915a2adcdb/_/download/contextbatch/css/jira.browse.project,jira.view.issue,project.issue.navigator,jira.global,atl.general,jira.general,-_super/batch.css?agile_global_admin_condition=true&is-server-instance=true&jag=true&jira.create.linked.issue=true&nps-acknowledged=true&richediton=true&spectrum=true","startTime":698.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":698.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":858.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":159.89999997615814,"initiatorType":"link","name":"https://jira.nuxeo.com/s/58ee667663b176be42acd7c1bf1fca70-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-components:adgs/com.atlassian.jira.jira-issue-nav-components:adgs.css","startTime":698.8000000715256,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":698.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":858.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":282.5,"initiatorType":"link","name":"https://jira.nuxeo.com/s/3a7dd25dffaa413b726809e5c41665e2-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-components:detailslayout-adgs/com.atlassian.jira.jira-issue-nav-components:detailslayout-adgs.css","startTime":699,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":981.5,"responseStart":0,"secureConnectionStart":0},{"duration":282.5,"initiatorType":"link","name":"https://jira.nuxeo.com/s/9f193be2cf34a2d9f34827ef09fd5117-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-components:simpleissuelist-adgs/com.atlassian.jira.jira-issue-nav-components:simpleissuelist-adgs.css","startTime":699.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":981.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":282.5,"initiatorType":"link","name":"https://jira.nuxeo.com/s/b38ff61ea9c3d25738508c97de341b7c-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-plugin:adgs-styles/com.atlassian.jira.jira-issue-nav-plugin:adgs-styles.css","startTime":699.3000000715256,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":981.8000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":282.3000000715256,"initiatorType":"link","name":"https://jira.nuxeo.com/s/9f193be2cf34a2d9f34827ef09fd5117-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-components:orderby-less-adgs/com.atlassian.jira.jira-issue-nav-components:orderby-less-adgs.css","startTime":699.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":981.8000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":282.2999999523163,"initiatorType":"link","name":"https://jira.nuxeo.com/s/58ee667663b176be42acd7c1bf1fca70-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-components:pager-less-adgs/com.atlassian.jira.jira-issue-nav-components:pager-less-adgs.css","startTime":699.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":981.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":282.09999990463257,"initiatorType":"link","name":"https://jira.nuxeo.com/s/51a66b137843ad74762ea96e11fcea54-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/8.8.28/_/download/batch/com.atlassian.jira.jira-issue-nav-components:issueviewer-adgs/com.atlassian.jira.jira-issue-nav-components:issueviewer-adgs.css","startTime":699.8000000715256,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":981.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":1212.4000000953674,"initiatorType":"script","name":"https://jira.nuxeo.com/s/0343a28e6625cb1d0257e79ca363dea4-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/3ea23cdeead70fbb915b7e17c50e42c1/_/download/contextbatch/js/_super/batch.js?locale=en&spectrum=true","startTime":699.8999999761581,"connectEnd":699.8999999761581,"connectStart":699.8999999761581,"domainLookupEnd":699.8999999761581,"domainLookupStart":699.8999999761581,"fetchStart":699.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":1298.2000000476837,"responseEnd":1912.3000000715256,"responseStart":1426.3000000715256,"secureConnectionStart":699.8999999761581},{"duration":1292.2999999523163,"initiatorType":"script","name":"https://jira.nuxeo.com/s/7e9e38ffc987108b13694e1be1eb1bed-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/97fb1ec5d0b5277162c4e1915a2adcdb/_/download/contextbatch/js/jira.browse.project,jira.view.issue,project.issue.navigator,jira.global,atl.general,jira.general,-_super/batch.js?agile_global_admin_condition=true&is-server-instance=true&jag=true&jira.create.linked.issue=true&locale=en&nps-acknowledged=true&richediton=true&spectrum=true","startTime":700.2000000476837,"connectEnd":700.2000000476837,"connectStart":700.2000000476837,"domainLookupEnd":700.2000000476837,"domainLookupStart":700.2000000476837,"fetchStart":700.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":978.6000000238419,"responseEnd":1992.5,"responseStart":1059.8999999761581,"secureConnectionStart":700.2000000476837},{"duration":597.1999999284744,"initiatorType":"script","name":"https://jira.nuxeo.com/s/fa5d26041e6d42624e01f62b619b847c-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/4.1.2/_/download/resources/com.atlassian.plugins.atlassian-chaperone:hotspot-tour/hotspot-tour.js?batch=false&locale=en","startTime":700.3000000715256,"connectEnd":1132.6000000238419,"connectStart":977.3999999761581,"domainLookupEnd":977.3999999761581,"domainLookupStart":977.3999999761581,"fetchStart":700.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":1132.6000000238419,"responseEnd":1297.5,"responseStart":1295.8999999761581,"secureConnectionStart":1054.6000000238419},{"duration":610.3000000715256,"initiatorType":"script","name":"https://jira.nuxeo.com/s/e88bd28120a9627756e47dd6bfa05ffa-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/9296915968fd19e3630cf5546b9a3e64/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en&spectrum=true","startTime":700.3999999761581,"connectEnd":700.3999999761581,"connectStart":700.3999999761581,"domainLookupEnd":700.3999999761581,"domainLookupStart":700.3999999761581,"fetchStart":700.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":1220.3999999761581,"responseEnd":1310.7000000476837,"responseStart":1303.1000000238419,"secureConnectionStart":700.3999999761581},{"duration":596.5,"initiatorType":"script","name":"https://jira.nuxeo.com/s/d41d8cd98f00b204e9800998ecf8427e-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":700.6000000238419,"connectEnd":1170.8000000715256,"connectStart":978,"domainLookupEnd":978,"domainLookupStart":978,"fetchStart":700.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":1171,"responseEnd":1297.1000000238419,"responseStart":1289.3000000715256,"secureConnectionStart":1054.8000000715256},{"duration":596.5,"initiatorType":"script","name":"https://jira.nuxeo.com/s/d41d8cd98f00b204e9800998ecf8427e-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":700.7000000476837,"connectEnd":1170.8000000715256,"connectStart":978.2000000476837,"domainLookupEnd":978.2000000476837,"domainLookupStart":978.2000000476837,"fetchStart":700.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":1171.1000000238419,"responseEnd":1297.2000000476837,"responseStart":1294.8000000715256,"secureConnectionStart":1055.1000000238419},{"duration":281,"initiatorType":"link","name":"https://jira.nuxeo.com/s/f3c9ba8d5e9cabff97d41646ac89c8d7-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/1a0982999fce04b10e665200ab846e27/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css?spectrum=true","startTime":701,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":701,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":982,"responseStart":0,"secureConnectionStart":0},{"duration":519.3000000715256,"initiatorType":"script","name":"https://jira.nuxeo.com/rest/api/1.0/shortcuts/712002/bec6e7941037acd10429766a4b8c82f0/shortcuts.js?context=issuenavigation&context=issueaction","startTime":701,"connectEnd":1137.7000000476837,"connectStart":978.2000000476837,"domainLookupEnd":978.2000000476837,"domainLookupStart":978.2000000476837,"fetchStart":701,"redirectEnd":0,"redirectStart":0,"requestStart":1137.8000000715256,"responseEnd":1220.3000000715256,"responseStart":1219.7000000476837,"secureConnectionStart":1057.3999999761581},{"duration":269.10000002384186,"initiatorType":"link","name":"https://jira.nuxeo.com/s/8876ed93fdf981b6100d58cfa44009a5-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/913cebf638c067015e2bca76a220f080/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true&richediton=true&spectrum=true","startTime":713,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":713,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":982.1000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":268.5,"initiatorType":"link","name":"https://jira.nuxeo.com/s/868d862ff95ebad6a27cb4f4db7a1b6b-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/4.5.30/_/download/batch/com.atlassian.jira.jira-projects-plugin:navigation-styles-adgs/com.atlassian.jira.jira-projects-plugin:navigation-styles-adgs.css","startTime":713.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":713.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":982.1000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":268.10000002384186,"initiatorType":"link","name":"https://jira.nuxeo.com/s/8b37eabc3931ebd6ce4360c67507a112-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/4.5.30/_/download/batch/com.atlassian.jira.jira-projects-plugin:footer-styles-adgs/com.atlassian.jira.jira-projects-plugin:footer-styles-adgs.css","startTime":714.1000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":714.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":982.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":583.2999999523163,"initiatorType":"script","name":"https://jira.nuxeo.com/s/bda68539ff22cd9532a2de5c855bc241-T/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/913cebf638c067015e2bca76a220f080/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en&richediton=true&spectrum=true","startTime":714.6000000238419,"connectEnd":1170.7000000476837,"connectStart":977.7000000476837,"domainLookupEnd":977.7000000476837,"domainLookupStart":977.7000000476837,"fetchStart":714.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":1170.8999999761581,"responseEnd":1297.8999999761581,"responseStart":1295.3999999761581,"secureConnectionStart":1058.3000000715256},{"duration":596.3999999761581,"initiatorType":"script","name":"https://jira.nuxeo.com/s/d41d8cd98f00b204e9800998ecf8427e-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":782,"connectEnd":782,"connectStart":782,"domainLookupEnd":782,"domainLookupStart":782,"fetchStart":782,"redirectEnd":0,"redirectStart":0,"requestStart":1298.3000000715256,"responseEnd":1378.3999999761581,"responseStart":1377.7000000476837,"secureConnectionStart":782},{"duration":792,"initiatorType":"script","name":"https://jira.nuxeo.com/s/d41d8cd98f00b204e9800998ecf8427e-CDN/grgf3g/712002/ea236f5a1b594a791f2e2cfd762387c0/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":782.7000000476837,"connectEnd":782.7000000476837,"connectStart":782.7000000476837,"domainLookupEnd":782.7000000476837,"domainLookupStart":782.7000000476837,"fetchStart":782.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":1494.7000000476837,"responseEnd":1574.7000000476837,"responseStart":1574,"secureConnectionStart":782.7000000476837},{"duration":233.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.nuxeo.com/rest/webResources/1.0/resources","startTime":2150.100000023842,"connectEnd":2150.100000023842,"connectStart":2150.100000023842,"domainLookupEnd":2150.100000023842,"domainLookupStart":2150.100000023842,"fetchStart":2150.100000023842,"redirectEnd":0,"redirectStart":0,"requestStart":2299.899999976158,"responseEnd":2383.5,"responseStart":2383,"secureConnectionStart":2150.100000023842}],"threshold":1000,"fetchStart":0,"domainLookupStart":3,"domainLookupEnd":184,"connectStart":184,"connectEnd":571,"secureConnectionStart":262,"requestStart":571,"responseStart":693,"responseEnd":782,"domLoading":697,"domInteractive":2600,"domContentLoadedEventStart":2600,"domContentLoadedEventEnd":2812,"domComplete":3426,"loadEventStart":3426,"loadEventEnd":3432,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[],"measures":[],"correlationId":"6c3bfb622cf19d","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":131,"dbReadsTimeInMs":57,"dbConnsTimeInMs":63,"applicationHash":"609a50578ba6bc73dbf8b05dddd7c04a04b6807c","experiments":[]}}