Post form values, process with c# in Composite C1 - c1-cms

This is probably easy to do but I've spent hours searching Composite C1 knowledge base and google but nothing.
I simply want to create an html form, then when the user submits it, be able to process the form fields in C#. I don't mind if this uses web forms, MVC or some other mechanism.
I have got inline functions working but it's not clear how to pass in the form fields.
thx.

The Form Submit Handler is a simple addon that accepts all the values posted to the page and saves it to files on the server.
It can be a good starting point to see how to work with Forms withing C1. The code for it is available on GitHub.

I am a composite c1 noob myself, but one thing that I did and it seemed fairly straight forward was to understand how the contact form that comes with the Venus starter site works.
The Venus template contact form is driven by the function found in Functions > Razor > Composite > Form > Contact Form.
You can edit that function and you can see how it's implemented. Inside that function you have access to the form data and you can do pretty much whatever you want with it, since it's C# and Razor.
Additionally, you can create a custom Global Datatype and optionally an associated Page Datafolder to save your data, or have access to it outside the form function. These will have to be bound to the form function.
You can get the data submitted from the form using the automatically generated functions (should be located under Functions > All Functions > YourNamespace > YourDatatype). I've used the GetMyDataTypeXml function for what I was needing and it worked without issues.
You can read more about data functions here: http://docs.composite.net/Data/Data-Centric-Functions
Some examples of using the GetMyDatatypeXml function can be found here: http://docs.composite.net/Data/Data-Centric-Functions/Getting-Data-as-XML
HTH!

Related

How to call Data Editor from Code, C1 CMS?

Under definition tree, I can attach event to open Data Editor for certain element.
However, I have no idea how to trigger the workflow to open the Editor for a given id.
I have a custom action URL which point to a custom ASPX (List of businesses about 50,000) in the console.
Now I want to trigger call the default data editor from the custom ASPX. Is that possible.
Yes you can. There is a few steps you need to take, but then you can basically mimic all console behaviors from your own aspx-page.
First of all you need to include the necessary C1 Console javascript frameworks on your page. Do that by calling ScriptLoader.Render("sub") and write the result on your page. You would also need to include this javascript on your page https://github.com/burningice2866/CompositeC1Contrib/blob/master/Teasers/Package/content/Composite/InstalledPackages/CompositeC1Contrib.Teasers/teaserConsoleFunctions.js - its some wrapper methods which are able to construct the javascript objects needed to call C1's webservice methods.
When that is setup you can trigger opening a Edit Workflow by calling the executeAction javascript method via a link containing the necessary ActionToken and EntityToken like this https://github.com/burningice2866/CompositeC1Contrib/blob/master/Teasers/Web/UI/TeaserHtmlHelper.cs#L65.
Its important to understand that everything in the C1 Console in based on these tokens. You don't edit something based on its id but always based on the EntityToken the something is represented by.
And what you want to do, whether its edit something or delete it, that thing you want to do is represented by an ActionToken. So to be able to edit something, you need an EntityToken for that something and a ActionToken for the Data Editor.

how to create different UI components every times in runtime and save their contents into database and save the UI which created on the page?

Dears
good day
I need your help for the following case:
The activity nature of the client is very dynamic
Need to have a dynamic form (he wants to create many form every day by himself in runtime). And add some components in the runtime.
He doesn't have a standard form so he need every day to create new form
For example he can make today a form with group of input text and group of check box and table and tomorrow he need to make a new form with input text and radio and table also etc..,.
In addition he needs to achieve and save it into database to use it and retrieve it later , and he wants to save every form with its UI contents which he created in runtime to be able to view it later on the jsf page.
So he want to save created form contains data into database
And also he wants to arrange the component on the page by his own way
And I putted this case in OTN :
https://community.oracle.com/message/14356236#14356236
How could I do it?
Regards
You can find a series of blog posts of Andrejus, right here:
http://andrejusb.blogspot.co.uk/2015/09/adf-12c-dynamic-forms-with-adf-bc-ui.html

firebase three-way binding and ng-bind-html

I'm creating a simple admin interface where an authenticated user is able to edit parts of a site, using firebase three-way binding (I'm using angularfire).
To be as user friendly as possible i at least want to allow them to have line breaks. Therefore i use ng-bind-html, but the problem is that real time validation will throw tons of errors until the entered html is valid (which is understandable).
I was wondering if this approach is even considered OK, or should i think differently. For example only update the view value once the user has finished typing, or create a button that would insert line breaks? Or maybe a filter that would return /n as <br>?
What are your experiences, suggestions? I dont really need html, the most i need is just line breaks.

Show Opportunity related Contacts in Custom Object Field

I have the next issue.
I have a custom object called 'Application', and I have this requirement:
"Show all Contacts related to an Application. Create a field on Application object, must be read only".
I solve it with apex code. 'Application' has a lookup to Opportunity, Opportunity to Account, and all my contacts have AccountId, so this way, I get all the contacts using apex code in a trigger.
But, I've been ask to change this to a Formula field in Application object.
So, my issue is next. I'm not able to get all contacts with advance formula editor, because they're not part of any object. I have no master-detail relationship.
Does any one know how can I achieve this using configuration? I should not use apex code for this req.
Thank in advance guys.
I don't think you can do it.
In formulas / merge fields syntax there's no way to go "up, up then down" (Application -> Opportunity -> Account -> down to Contacts related list). There's also nothing that would let you loop through Contacts (and display what? Ids? Names? Emails?). Roughly speaking you can only go up through dots.
You might want to explore path of "cross object workflow" rules but I imagine that when I add a new Contact to Account it should somehow "spread itself" to all related Applications? There's no straight way to fire a workflow on delete too - so you'd eventually end up with inaccurate list.
I'd say trigger was a good solution. Maybe it ws unoptimized but if it has to be in a field - tough.
There might be a fairly simple way of achieving that by embedding a visualforce page within Application page layout.
This should be doable with pure Visualforce (so technically there will be no Apex code ;))
Something as simple as
<apex:relatedList list="Contacts" subject="Application__c.Opportunity__r.AccountId" />
would be a good start (if you want your own layout and not a rel. list - you should be still able to pull it off with <apex:repeat> or <apex:pageBlockTable>.
There's one BUT here: it's not a field, just a display trick. Forget about using it in reports, mobile applications etc.
Another way - would it be acceptable to be 1 click away from these contacts? You could make a report "Account with Contacts", filter it by Id of one Account and later use "URL hacking" to change the filter depending on from which Application you'll click it. This link could be either a formula field or a real custom button/link. Technically - it's pure config, no apex & VF.
You can read more about URL hacking at Ray Dehler's excellent post and specifically about dynamic Reports here or here.

Salesforce.com visualforce between 2 objects

In salesforce I need to create a visualforce page that includes the fields of 2 objects. The first object is the QUOTE object. The second objects is a custom object with several fields.
I want to create a visualforce page that shows the records of both QUOTE and the new object. Can I do this without creating a custom controller? If no any hints on the code for this new controller?
Can I do calculations between fields in a visualforce page?
Ideally I want this page to appear as soon as the QUOTE is set to ACCEPTED
1: You can't do this without a custom controller unfortunately, unless one object is related to the other and you're just happy displaying it as a related list on the parent object's page. For calculations you could use rollup summaries for some basic sums etc..
As for a custom controller, have a look at field sets for a super easy way to get fields into a VF page, you essentially configure groups of fields on your objects and then you can stick those groups onto a page with minimal markup.
2: For fields with complex calculations you'll want to do the sums in the controller and then expose the results through variables onto the page in the usual manner.
3: Not really possible without creating a custom edit page in the first place — you'd be better off having a button on the quote page to open up the Visualforce page, that page can simply display an error if the quote is not yet accepted. There are some other alternatives that might work though, like using a forumla field to generate a link to the page when the status is as you desire.
I'm happy to elaborate on any of this, but the fact that you're asking about number 2 would suggest to me that you don't have much experience developing on the platform (not a dig, just an observation), so unless you're comfortable coding in other environments you could find this quite tricky. That said, you're on stackoverflow so I'm thinking you probably know a little about coding at least!

Resources