-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 8.10
-
Fix Version/s: 8.10-HF33
-
Component/s: Automation
The parameters passed to an Automation Scripting seems to be cached, hence the second time the script is called, it used the previous values.
Here is a scenario to reproduce the problem with the attached jar
- Navigate to the User workspace as Administrator
- Create a Folder named Folder
- Click on the New button
- Choose Note document type
- Observe that the title has the value "A Son of Folder"
- Navigate to the User workspace
- Click on the New button
- Choose Note document type
- Observe that the title still has the value "A Son of Folder"
I've added some logging in the Automation Chain (ERROR level) and in the Automation script (WARN level) and I observe that:
- the value read in the Automation chain is correct
- the value read in the Automation script is incorrect the second time and seems to be read from a cache
14:33:03,414 ERROR [logger] Parent = /default-domain/UserWorkspaces/Administrator 14:33:07,147 WARN [Console] parent path: /default-domain/UserWorkspaces/Administrator 14:33:07,233 WARN [Console] parent: DocumentModelImpl(c93b2809-58ef-4590-88bd-1662e60fcacf, path=/default-domain/UserWorkspaces/Administrator, title=c93b2809-58ef-4590-88bd-1662e60fcacf) 14:33:21,745 ERROR [logger] Parent = /default-domain/UserWorkspaces/Administrator/Folder 14:33:22,744 WARN [Console] parent path: /default-domain/UserWorkspaces/Administrator 14:33:22,780 WARN [Console] parent: DocumentModelImpl(c93b2809-58ef-4590-88bd-1662e60fcacf, path=/default-domain/UserWorkspaces/Administrator, title=c93b2809-58ef-4590-88bd-1662e60fcacf)
Code of the Automation Chain
- Context.FetchDocument - Log: level: error message: "Parent = @{Event.context.getProperty('parentPath')}" - javascript.setDefault: parentPath: "@{Event.context.getProperty('parentPath')}"
Code of the Automation Scripting
function run(input, params) { var properties = {}; Console.warn("parent path: " + params.parentPath); var parent = Repository.GetDocument(null, {"value": params.parentPath}); Console.warn('parent: ' + parent); var title = parent.getPropertyValue("dc:title"); properties["dc:title"] = "A Son of " + title; input = Document.Update(input, { 'properties': properties, 'save': false }); return input; }
The bug cannot be reproduced in 9.1 maybe a consequence of the work done by NXP-21294
- is related to
-
NXP-21294 automation scripting should run thread-safe
- Resolved