Magnolia detail subapp commit action - magnolia

I'm on magnolia 6.2.15 and I need to generate data from some fields that users insert in a content detail subapp.
I thought about creating a subclass of magnolia "SaveDetailSubAppAction", in the "execute" method to do the job.
I can retrieve fields value but, how can I generate new fields data values and insert that in the form before validation and commit to jcr datasource?

Well you can't. Or rather you shouldn't. The form is means for user to enter the data. If you create data programatically, you either send it directly to the datasource or store it directly on the node that datasource operates on.
If you want to show generated data to user for approval prior saving, then you need to create custom field that would have the place for extra input and would react on user generated input directly prior to saving content.

Related

What is the proper way to add records to a V2 odata model with two way binding in SAP UI5?

I have a SAP UI5 V2 odata model with a two way binding to a table and to a form.
The table is displaying all records, and when clicking on a record, I am using setBindingContext to bind the selected table record to the form for editing. When typing in the form, the values dynamically update in the table (because of the two way binding). model.submitChanges() writes the change back to the server.
So displaying the list, and editing records in the list are working just fine.
Now for the problem How to create records with the same form?
I also want to use the same form for adding new records, but I cannot figure out how to unbind the form from a previously selected record, or otherwise create a new blank entry in the data model to be sent to the server.
All of the tutorials I have been able to find on doing UI5 Odata CRUD operations don't really address this problem.
I discovered this example in the documentation which pointed me in the correct direction.
In summary, you use the oModel.createEntry method to create a new entry in the oData Model. You then have to bind this new entry to your form with setBindingContext - this is the part I was missing.

Create custom Insert Form

I would like to create a Dialog PageFragment that functions exactly as the default Insert Form widget does, except with my own collection of dropdowns and text boxes. It should fill out a ‘draft’ record of the user-inputted data as the user enters it, as explained in the documentation here, then when the user clicks Create/Insert/Submit, the draft is inserted as a new record into a data model, which is displayed as a Table widget. The draft record is then emptied.
I'm sure that I can implement this by calling a server script that create a new item/record in the datasource, but I'm not sure of how exactly to begin implementing that.

Alfresco activiti workflow

Is it possible to view an already filled form in a review step ? I have created a simple workflow, where the process starts with the user filling in a form. The filled form gets assigned to another user(lets call the user ABC) for reviewing. Is it possible for ABC to view the form filled by the user ? I am using the kickstart app to create a business process model.
You will have to copy the variables from the task with "fill form", to the task with the "review form", via the workflow Executioncontext. The var names in activiti (my_property) are then mapped to the var names in the alfresco content model/share forms (my:property) (but by substituting the ":" sign to a "_" sign).
You can do the copying of vars between tasks using TaskListeners in your bpmn2.0 file. See more here http://docs.alfresco.com/5.1/concepts/wf-process-def-listeners.html
The gui from Activiti kickstart (AFAIK) is too limited to do this for you.
When you want to assign a prefilled form for review to next stage in workflow process, you can use the form field called "Display Value".
Add the 'Display value' from the form field options. Press 'Pencil' icon to update the display value.
From the dropdown list, select the form field values that is to be displayed in the review form.
Display Value Activiti

Populating insert values in asp.net dynamic data site?

I'm using Visual Studio 2010 to create a dynamic data site with scaffolding according to: http://www.asp.net/web-forms/videos/aspnet-dynamic-data/your-first-scaffold-and-what-is-dynamic-data
The site displays a SQL table with an "Insert New Item" link, which takes you here:
I have another SQL table which holds some of the information already. I would like to add a function that is called when the user navigates away from the "account" field; the function will query the other SQL table and populate the fields that it already holds for that account.
I'm stuck on where to put the function and how to setup the account field to call it.
It's a couple of years since I did one of these so pardon the details being a bit short.
You can 'override' the default New Item form. In that you can pre-populate the fields with anything you want. I think you have to take care of the Save also, and of setting out the controls on the form and populating them (you've overridden the generated form after all).
Another possibility is to create a partial class which extends the Model class and populates it in a constructor extension (I remember doing various stuff with this technique). There might also be some extension points on the model Context (or whatever its called) which you can tap into - it's pretty flexible as I remember.

Razor MVC - Object Edit Field Change Log

Users modify a DB object in an edit form that I have, pretty straight forward.
I need to implement a 'change log' on this object. I need to record which fields where changed and what they were before and after. I'm using Razor MVC.
I've done this by writing triggers for the table on update/delete. On update/delete of a record, the trigger pushes the record to a History table, in a History database. This creates the change log. Then you would just need to display it; to identify the change would require evaluating each and every field.
There's nothing already built that wold do this for you that I know of.

Resources