I have a data filed in data file (called divert) and currently is set to N. But I would like to modify it with a script in workflow to a different value like Y dynamically. I know how to get the current value from metadata and even modify the value to Y in the metadata. However, the data file in the connect template is remaining the same vale N. Is there a way to modify the data file dynamically via the script? Or is there a way to map the connect template with the modified metadata?
When you use the Create Content tasks in your Workflow process, there is an option to Update Records from metadata. Tick the option to ensure that any change to the metadata is reflected in the Data records prior to the content being generated.
There is also a stand alone task named Update Data Records that allows you to achieve the same thing but without having to generate content immediately.
Thanks a lot, Phil. Do you have a sample coding for get the data from metadata and modify the value back to the metadata? The way I did to retrieve the data from metadata and modify the value back to metadata is not working properly for some reason.
You don’t need a script, you can use the Metadata Fields Management task to do that for you…
Here’s how:
Add the task to your process.
In the Action column, select Add (this adds a field if it doesn’t exist OR replaces the field value if it already exists, which is what you want here).
In the Field Information column, select the Document level. Then in the Field Name type the name of the metadata filed you want to replace (something like _vger_fld_divert, the vger_fld prefix always signals that a metadata field was extracted from the data model). Finally, type the value you want to store in the field (presumably, Y).
Now if you stop there, all values for fields named _vger_fld_divert, in all documents will be replaced. But if you want, you can add a rule that only replaces a subset of those documents. For instance, you could want to change the field value only if it already contains a “N” and nothing else. Take a look at the online documentation for the Rule interface for more information: http://help.objectiflune.com/en/pres-workflow-user-guide/8.6/Default.html#Workflow/OtherFeatures/Rule_Interface.html