...
Note that when you login, the .NET client API initializes a local security token based on your credentials. It does not actually make a call however, until you make your first request. At that time, the forms service will attempt to authorize you based on your token. In the above example, the first call is for the user entry.
The LoginAs method for an existing user:
This new method allows you to login as any of the existing tenant users provided you can pass in the tenant's admin user and password. This is quite convenient when you want login using the same user that is logged into your application without having to know their password.
Code Block |
---|
IDictionary<string, string> customParams = new Dictionary<string, string>(); customParams.Add("autoLogin", "true"); FormsService service = new FormsService("http://localhost:8082", "yourappname"); service.LoginAs( "myuser", "tenantAdminUserName@myTenantName", "tenantAdminPassword", false, null, null, null, null, customParams); UserEntry user = service.GetUser(“myuser”); // interact with frevvo service.Logout(); |
How do I get the list of all applications for the current user?
...
The LoginAs method for a new/undefined user:
When your tenant is configured with the Delegating Security Manager, you can use the loginAs() method to automatically create new/virtual users.
Code Block |
---|
IDictionary<string,string> customParams = new Dictionary<string, string>(); ApplicationQuery query = servicecustomParams.CreateApplicationQuery(nullAdd("autoLogin", "true"); string[] roles ApplicationFeed apps = service.Query(query);= { "frevvo.Designer" }; FormsService service = new FormsService("http://localhost:8082", "yourappname"); foreach (ApplicationEntry app in apps.Entries) { service.LoginAs( Console.WriteLine("App: " + app.Title.Text); "newUserName", // ..."tenantAdminUserName@myTenantName", } |
How do I get the list of all themes for the current user?
Code Block |
---|
FormsService service = ...; "tenantAdminPassword", ThemeQuery query = service.CreateThemeQuery(null); ThemeFeed themes = service.Query(query); true, foreach (ThemeEntry theme in themes.Entries) { roles, //optional param – may be null. Specified roles Console.WriteLine("Theme: " + theme.Title.Text); } |
How do I get the list of all forms for the current user?
Code Block |
---|
FormsService service = ...; FormTypeQuery query = service.CreateFormTypeQuery(null);will be created if necessary. When null, a non-designer user (able to participate in flows but not create flows/forms) will be created if necessary. FormTypeFeed themes = service.Query(query); "newUserFirstName", foreach (ThemeEntry formType in formTypes.Entries) //optional param – may be null { Console.WriteLine("Form Type: " + formType.Title.Text); } |
How do I get the list of all forms for a given application?
The code snippet below prints the name of all forms in the appEntry application:
Code Block |
---|
"newUserLastName", //optional param – may be null ApplicationEntry app = ...; // find the right application "newUserEmailName@EmailServer.com", //optional FormTypeFeedparam formTypes– = app.FormTypeFeed; may be null foreach(FormTypeEntry formType in formTypes.Entries) { customParams); UserEntry user = Consoleservice.WriteLineGetUser("Form Type: " + formType.Title.TextnewUserName"); } |
How do I get the list of all schemas for the current user?
Code Block |
---|
SchemaQuery query = service.CreateSchemaQuery(null); SchemaFeed schemas = service.Query(query); // interact with frevvo foreach (SchemaEntry schema in schemas.Entries) { Console.WriteLine("Schema: " + schema.Title.Text); } |
How do I get the list of all schemas for a given application?
The code snippet below prints the name of all schemas in the appEntry application:
Code Block |
---|
ApplicationEntry appservice.Logout(); |
Note |
---|
When you login, the .NET client API initializes a local security token based on the supplied credentials. It does not actually make a call however, until the first request is executed. At that time, the forms service will attempt to authorize the user based on the provided token. In the above examples, the first call is for the user entry. |
How do I get the list of all applications for the current user?
Code Block |
---|
FormsService service = ...; // find the right application ApplicationQuery query SchemaFeed schemas = app.SchemaFeedservice.CreateApplicationQuery(null); foreach (SchemaEntry schemaApplicationFeed apps = service.Query(query); foreach (ApplicationEntry app in schemasapps.Entries) { Console.WriteLine("SchemaApp: " + schemaapp.Title.Text); // ... } |
How do I
...
get the list of all themes for the current user?
Code Block |
---|
FormsService fsservice = ....; ApplicationQueryThemeQuery query = fsservice.CreateApplicationQueryCreateThemeQuery(null); ApplicationFeedThemeFeed appsthemes = fsservice.Query(query); ApplicationEntryforeach app = apps.CreateEntry();(ThemeEntry theme in themes.Entries) { app.Title.Text = "My First App"; app = appsConsole.Insert(app);WriteLine("Theme: " + theme.Title.Text); } |
How do I
...
get the list of all forms for the current user?
Code Block |
---|
FormsService fsservice = ....; ApplicationQueryFormTypeQuery query = fsservice.CreateApplicationQueryCreateFormTypeQuery(null); ApplicationFeedFormTypeFeed appsformTypes = fsservice.Query(query); foreach (ApplicationEntryFormTypeEntry appformType in appsformTypes.Entries) { { if( app.Title.Text == Console.WriteLine("MyForm FirstType: App" ) return app.Id.Uri+ formType.Title.Text); } |
How do I
...
get the list of all forms for a given application?
...
The code snippet below prints the name of all forms in the appEntry application:
Code Block |
---|
ApplicationEntry app = ...; // find the right application app.Delete(); |
How do I upload an Application for a specific user?
First get a hold of the corresponding UserEntry for the desired user, and then use the users ApplicationFeed.
Code Block |
---|
string fileName FormTypeFeed formTypes = app....FormTypeFeed; UserEntry user = ....; MediaFileSource source = new MediaFileSource(fileName, ApplicationFeed.MEDIA_SOURCE_TYPE); ApplicationFeed apps = user.ApplicationFeed; ApplicationEntry app = apps.CreateEntry(); app.MediaSource = source; app = apps.Insert(app); |
How do I upload an Application?
Code Block |
---|
string fileName = ....;
string appName = ....;
FormsService formsService = ....;
MediaFileSource source = new MediaFileSource(fileName,
ApplicationFeed.MEDIA_SOURCE_TYPE);
ApplicationQuery query = formsService.CreateApplicationQuery(null);
ApplicationFeed apps = formsService.Query(query);
ApplicationEntry app = apps.CreateEntry();
app.Title.Text = appName;
app.MediaSource = source;
app = apps.Insert(app); |
How do I download an Application?
Code Block |
---|
FormsService formsService = ....; ApplicationEntry entry = ....; string fileName = ....; foreach(FormTypeEntry formType in formTypes.Entries) { Console.WriteLine("Form Type: " + formType.Title.Text); } |
How do I get the list of all schemas for the current user?
Code Block |
---|
SchemaQuery query = service.CreateSchemaQuery(null);
SchemaFeed schemas = service.Query(query);
foreach (SchemaEntry schema in schemas.Entries)
{
Console.WriteLine("Schema: " + schema.Title.Text);
} |
How do I get the list of all schemas for a given application?
The code snippet below prints the name of all schemas in the appEntry application:
Code Block |
---|
ApplicationEntry app = ...; // find the right application SchemaFeed schemas = app.SchemaFeed; foreach (SchemaEntry schema in schemas.Entries) { Console.WriteLine("Schema: " Stream contentStream = formsService.QueryContent(entry.Content+ schema.Title.Text); //if the } |
How do I create an Application?
Code Block |
---|
needs to be writtenFormsService tofs a file: using (FileStream fileStream= ....; ApplicationQuery query = Filefs.CreateCreateApplicationQuery(fileNamenull)); { ApplicationFeed contentStream.CopyTo(fileStream); } |
After I found a ApplicationEntry for the first time can I get the entry directly?
If you have an entry id you can retrieve the entry directly.
Code Block |
---|
apps = fs.Query(query); stringApplicationEntry appIdapp = apps...CreateEntry(); FormsService fs = ....; app.Title.Text = "My First App"; ApplicationEntry app = fsapps.GetApplicationInsert(appIdapp); |
How do I
...
find an existing Application?
At this point you have to manually filter the entries in an ApplicationFeed. See the following snippet:
Code Block |
---|
FormTypeEntryFormsService formTypefs = ...; // find the correct formtype entry.; ApplicationQuery query = fs.CreateApplicationQuery(null); stringApplicationFeed formTypeUrlapps = formType.FormTypeEmbedLink.AbsoluteUri; |
Then using the url in formTypeUrl above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{formTypeUrl}"></script> |
This will embed the form in your page inside an <iframe/>.
How do I get the url to the form designer so it can be embedded in my HTML pages?
First get a hold of the corresponding FormTypeEntry, then get the formType url as shown in the snipped below:
Code Block |
---|
FormTypeEntry formType = ...; // find the correct formtype entry
string designerUrl = formType.FormTypeEditorEmbedLink.AbsoluteUri; |
Then using the designerUr' above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{designerUrl}"></script> |
This will embed the form designer in your page inside an <iframe/>.
...
fs.Query(query);
foreach(ApplicationEntry app in apps.Entries)
{
if( app.Title.Text == "My First App" )
return app.Id.Uri;
} |
How do I delete an Application?
Code Block |
---|
ApplicationEntry app = ...; // find the right application
app.Delete(); |
How do I upload an Application for a specific user?
First get a hold of the corresponding FormTypeEntry UserEntry for the desired user, and then get the form url as shown in the snipped below:use the users ApplicationFeed.
Code Block |
---|
string fileName = ....; FormTypeEntryUserEntry formTypeuser = ....; // findMediaFileSource thesource correct= formtype entry string formSubmissionsUrl = formType.SubmissionsEmbedLink.AbsoluteUri; |
Then using the formSubmissionsUrl above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{formSubmissionsUrl}"></script> |
This will embed the submissions view in your page inside an <iframe/>.
How do I get the url to the form instance so it can be embedded in my HTML pages?
First get a hold of the corresponding FormTypeEntry, then get the form instance url as shown in the snippet below:
Code Block |
---|
FormTypeEntry formTypenew MediaFileSource(fileName, ApplicationFeed.MEDIA_SOURCE_TYPE); ApplicationFeed apps = user.ApplicationFeed; ApplicationEntry app = apps.CreateEntry(); app.MediaSource = source; app = apps.Insert(app); |
How do I upload an Application?
Code Block |
---|
string fileName = ....; string appName = ....; NameValueCollectionFormsService nvcformsService = null; Uri formInstanceUri = formType.CreateFormInstance(nvc); string formInstanceUrl = formInstanceUri.AbsoluteUri; |
Then using the formInstanceUrl above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{formInstanceUrl}"></script> |
This will embed the form instance in your page inside an <iframe/>.
How do I get a form entry based on a known id?
This is often needed when you need to relate a form with another concept your application (e.g. you application has the concept of a report that has an associated form). In this case you will store the form id somewhere and when needed fetch the form entry to embed it in your page, delete it, etc.
Here is how you get the for a form entry (in fact any entry):
Code Block |
---|
FormTypeEntry formType = ...; // find an entry
string formTypeId = formType.Id.Uri; |
Here you can associate the formtype id with your application objects and retrieve the corresponding entry at any time as follows:
Code Block |
---|
string formtypeId = "....";
FormTypeEntry formtype = service.GetFormType(formtypeId); |
How do I delete a form (or any other entry)?
By calling the delete method on the FormTypeEnty.
Code Block |
---|
FormTypeEntry formType = ...;
formType.Delete; |
How do I create a new form?
...
....;
MediaFileSource source = new MediaFileSource(fileName,
ApplicationFeed.MEDIA_SOURCE_TYPE);
ApplicationQuery query = formsService.CreateApplicationQuery(null);
ApplicationFeed apps = formsService.Query(query);
ApplicationEntry app = apps.CreateEntry();
app.MediaSource = source;
app = apps.Insert(app); |
How do I rename an application?
Code Block |
---|
String filename = ...;
ApplicationEntry app = ...; // find the right application
app.Title.Text = appName;
app.Update(); |
Note |
---|
The method ApplicationEntry.Update() is only available in .Net Client API version 5.1 Patch 3 and later. |
How do I download an Application?
Code Block |
---|
FormsService formsService = ....;
ApplicationEntry entry = ....;
string fileName = ....;
Stream contentStream = formsService.QueryContent(entry.Content);
//if the Application needs to be written to a file:
using (FileStream fileStream = File.Create(fileName))
{
contentStream.CopyTo(fileStream);
} |
After I found a ApplicationEntry for the first time can I get the entry directly?
If you have an entry id you can retrieve the entry directly.
Code Block |
---|
FormsServicestring serviceappId = ...; ApplicationEntryFormsService appfs = ....; // find an application ApplicationEntry FormTypeFeed formtypesapp = app.FormTypeFeed; FormTypeEntry formtype = formtypes.CreateEntry(); formtype.Title.Text = name; formtype.Summary.Text = description; formtype = formtypes.Insert(formtype); |
Note |
---|
When inserting the original formtype variable will not' be updated and the updated entry will be returned by the Insert method. |
How do I create a new form using an existing one as a template?
The only difference between creating a new form and creating a new one based on an existing form is that instead of using the entry created by calling 'ftFeed.createEntry()' you will be using an existing form entry. Find an existing form entry, update its name and description and use that entry to insert into a feed. Do not override the entry id otherwise the insert will fail.
Code Block |
---|
FormsService service = ...; ApplicationEntry appfs.GetApplication(appId); |
How do I get the url to a form so it can be embedded in my HTML pages?
First get a hold of the corresponding FormTypeEntry, then get the form url as shown in the snipped below:
Code Block |
---|
FormTypeEntry formType = ...; // find the correct formtype entry
string formTypeUrl = formType.FormTypeEmbedLink.AbsoluteUri; |
Then using the url in formTypeUrl above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{formTypeUrl}"></script> |
This will embed the form in your page inside an <iframe/>.
How do I get the url to the form designer so it can be embedded in my HTML pages?
First get a hold of the corresponding FormTypeEntry, then get the formType url as shown in the snipped below:
Code Block |
---|
FormTypeEntry formType = ...; // find anthe applicationcorrect formtype entry FormTypeFeed formtypes = app.FormTypeFeed; FormTypeEntry template string designerUrl = formType.FormTypeEditorEmbedLink..; // find template formtype entry // modify key template properties template.Title.Text = name; template.Summary.Text = description; FormTypeEntry formtype = formtypes.Insert(template); |
How do I create a form instance?
Use the code below to create a form instance:
Code Block |
---|
FormsService service = ...;
string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1";
FormTypeEntry formType = service.GetFormType(id);
FormEntry form = formType.CreateFormEntry(); |
How do I pre-populate values when creating an instance?
When creating a form instance, you can supply data to pre-populate fields. There are a couple of ways to do this. The first way is to supply a name value collection, which holds control names and values. The second way is to supply an XML document, with control names and values. Suppose your form has two text fields, named A and B respectively. Also, suppose you wish to prefill these 2 controls with values, as shown:
Example 1 – using a name value collection
This example uses a special parameter named _data. The value carries a formatted string containing the form values, as shown below.
Code Block |
---|
AbsoluteUri; |
Then using the designerUr' above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{designerUrl}"></script> |
This will embed the form designer in your page inside an <iframe/>.
How do I get the url to the form submissions so it can be embedded in my HTML pages?
First get a hold of the corresponding FormTypeEntry, then get the form url as shown in the snipped below:
Code Block |
---|
FormTypeEntry formType = ...; // find the correct formtype entry
string formSubmissionsUrl = formType.SubmissionsEmbedLink.AbsoluteUri; |
Then using the formSubmissionsUrl above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript" src="{formSubmissionsUrl}"></script> |
This will embed the submissions view in your page inside an <iframe/>.
How do I get the url to the form instance so it can be embedded in my HTML pages?
First get a hold of the corresponding FormTypeEntry, then get the form instance url as shown in the snippet below:
Code Block |
---|
FormTypeEntry formType = ....;
NameValueCollection nvc = null;
Uri formInstanceUri = formType.CreateFormInstance(nvc);
string formInstanceUrl = formInstanceUri.AbsoluteUri; |
Then using the formInstanceUrl above you can generate the following iframe tag in your html page:
Code Block |
---|
<iframe src="{formInstanceUrl}"/> |
This will embed the form instance in your page inside an <iframe/>.
How do I get the url to return the form instance embed java script?
First get a hold of the corresponding FormTypeEntry and then get the url as shown in the snippet below:
Code Block |
---|
FormTypeEntry formType = ...; // find the correct formtype entry
NameValueCollection nvc = new NameValueCollection();
nvc.Add("_data", "{TextArea3:TestTestTest}");
Uri formInstanceEmbedUri = formType.CreateFormInstanceEmbed(nvc, null);
String formInstanceUrl = formInstanceEmbedUri.AbsoluteUri; |
Then using the formInstanceUrl above you can generate the following script tag in your html page:
Code Block |
---|
<script type="text/javascript"
src="{formInstanceUrl}"></script> |
This will embed the form instance in your page inside an <iframe/>.
Note |
---|
|
How do I get a form entry based on a known id?
This is often needed when you need to relate a form with another concept your application (e.g. you application has the concept of a report that has an associated form). In this case you will store the form id somewhere and when needed fetch the form entry to embed it in your page, delete it, etc.
Here is how you get the for a form entry (in fact any entry):
Code Block |
---|
FormTypeEntry formType = ...; // find an entry
string formTypeId = formType.Id.Uri; |
Here you can associate the formtype id with your application objects and retrieve the corresponding entry at any time as follows:
Code Block |
---|
string formtypeId = "....";
FormTypeEntry formtype = service.GetFormType(formtypeId); |
How do I delete a form (or any other entry)?
By calling the delete method on the FormTypeEnty.
Code Block |
---|
FormTypeEntry formType = ...;
formType.Delete; |
How do I create a new form?
First you have to get a hold of the form feed from an existing application. See How do I get the list of all forms for a given application?.
Code Block |
---|
FormsService service = ...;
ApplicationEntry app = ...; // find an application
FormTypeFeed formtypes = app.FormTypeFeed;
FormTypeEntry formtype = formtypes.CreateEntry();
formtype.Title.Text = name;
formtype.Summary.Text = description;
formtype = formtypes.Insert(formtype); |
Note |
---|
When inserting the original formtype variable will not' be updated and the updated entry will be returned by the Insert method. |
How do I create a new form using an existing one as a template?
The only difference between creating a new form and creating a new one based on an existing form is that instead of using the entry created by calling 'ftFeed.createEntry()' you will be using an existing form entry. Find an existing form entry, update its name and description and use that entry to insert into a feed. Do not override the entry id otherwise the insert will fail.
Code Block |
---|
FormsService service = ...;
ApplicationEntry app = ...; // find an application
FormTypeFeed formtypes = app.FormTypeFeed;
FormTypeEntry template = ...; // find template formtype entry
// modify key template properties
template.Title.Text = name;
template.Summary.Text = description;
FormTypeEntry formtype = formtypes.Insert(template); |
How do I create a form instance?
Use the code below to create a form instance:
Code Block |
---|
FormsService service = ...;
string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1";
FormTypeEntry formType = service.GetFormType(id);
FormEntry form = formType.CreateFormEntry(); |
How do I create a form instance in edit mode?
Code Block |
---|
FormsService service = ...;
string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1";
FormTypeEntry formType = service.GetFormType(id);
FormEntry formEntry = formType.CreateEditingFormEntry(); |
Note |
---|
The method FormTypeEntry.CreateEditingFormEntry is only available in .Net Client API version 5.1 Patch 3 and later. |
How do I save edits to a form instance that was created in edit mode?
Code Block |
---|
FormTypeEntry formType = ...;
FormEntry formEntry = formType.CreateEditingFormEntry();
//make edits to form
formEntry.SubmitEdit(); |
Note |
---|
The method FormEntry.SubmitEdit is only available in .Net Client API version 5.1 Patch 3 and later. |
How do I cancel edits to a form instance that was created in edit mode?
Code Block |
---|
FormTypeEntry formType = ...;
FormEntry formEntry = formType.CreateEditingFormEntry();
//make edits to form
formEntry.SubmitEdit(false); |
Note |
---|
The method FormEntry.SubmitEdit is only available in .Net Client API version 5.1 Patch 3 and later. |
How do I create a form such that the document set is returned when the form is submitted?
First get a hold of the corresponding FormTypeEntry and then specify the _formActionDocs parameter as true when creating the FormEntry.
Code Block |
---|
FormTypeEntry formTypeEntry = ...; // find the correct formtype entry
// request all data come back as part of the submit response
NameValueCollection linkParams = new NameValueCollection();
linkParams.Add("_formActionDocs", "true");
linkParams.Add("_data","{FirstName:TestA,LastName:TestB}");
FormEntry formEntry = formTypeEntry.CreateFormEntry(linkParams); |
Note |
---|
The _formActionDocs parameter is only supported by .Net Client API version 5.1 Patch 3 and later. |
How do I receive the document set (including attachments) for the Form when submitted?
Code Block |
---|
FormEntry formEntry = ...; // created with the _formActionDocs param set to true
IList<MultipartContentElement> responseData = formEntry.SubmitInstance();
foreach (MultipartContentElement part in responseData)
{
string dispositionType = part.ContentDispositionType;
string name = part.Name;
string contentType = part.ContentType;
string contentTransferEncoding = part.ContentTransferEncoding;
string data = part.DataPayload;
} |
Note |
---|
|
How do I pre-populate values when creating an instance?
Example 1 – using a name value collection
This example uses a special parameter named _data. The value carries a formatted string containing the form values, as shown below.
Code Block |
---|
FormsService service = ...;
NameValueCollection nvc = new NameValueCollection();
nvc.Add("_data", "{A:TestA,B:TestB}");
string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1";
FormTypeEntry formType = service.GetFormType(id);
FormEntry form = formType.CreateFormEntry(nvc);
|
Example 2 – using an XML document
This example uses an XML document. The document structure contains the form values which are to be applied, as shown below.
Code Block |
---|
<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ"
name="FormTypeAtomTest">
<A>TestA</A>
<B>TestB</B>
</ns:form>
FormsService service = ...;
using (FileStream docStream = File.Open(@"C:\temp\_data.xml", FileMode.Open))
{
string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1";
FormTypeEntry formType = service.GetFormType(id);
FormEntry form = formType.CreateFormEntry(docStream);
}
|
Example 3 – using link parameters and an XML document
Code Block |
---|
<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ"
name="FormTypeAtomTest">
<A>TestA</A>
<B>TestB</B>
<C>2013-06-30</C>
</ns:form>
FormsService service = ...;
NameValueCollection nvc = new NameValueCollection();
nvc.Add("_formTz", "Asia/Kolkata");
using (FileStream docStream = File.Open(@"C:\temp\_data2.xml", FileMode.Open))
{
string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1";
FormTypeEntry formType = service.GetFormType(id);
FormEntry form = formType.CreateFormEntry(nvc, docStream);
}
|
Note |
---|
|
Example 4 – using link parameters and multiple files
Code Block |
---|
<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ" name="FormTypeAtomTest"> <A>TestA</A> <B>TestB</B> <C>2013-06-30</C> </ns:form> <p0:form xmlns:p0="http://www.frevvo.com/schemas/_RErWMNR6EeKYJfUGgkkEjg"> <Section518> <Name>test1</Name> </Section518> </p0:form> FileStream customerDataXml = new FileStream(file1_path,FileMode.Open); FileStream signText = new FileStream(file2_path, FileMode.Open); FormsService service = ...; NameValueCollection nvc = new NameValueCollection(); nvc.Add("_dataformTz", "{A:TestA,B:TestB}Asia/Kolkata"); string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1test2"; FormTypeEntry formType = service.GetFormType(id); FormEntry formformEntry = formTypeformTypeEntry.CreateFormEntry(nvc); |
Example 2 – using an XML document
This example uses an XML document. The document structure contains the form values which are to be applied, as shown below.
Code Block |
---|
<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ", name="FormTypeAtomTest"> <A>TestA</A> <B>TestB</B> </ns:form> FormsService service = ...; using (FileStream docStream =new File.Open(@"C:\temp\_data.xml", FileMode.Open)) {MediaFileSource(customerDataXml, "customer", "application/xml"), string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1"; FormTypeEntry formType = service.GetFormType(id); new FormEntryMediaFileSource(signText, "form = formType.CreateFormEntry(docStream); } ", "application/xml")); customerDataXml.Dispose(); signText.Dispose(); |
Note |
---|
|
How do I edit a form control?
...
Code Block |
---|
FormEntry form = ...; ControlEntry controlA = form.FindControlEntry("A"); controlA.Value = "TestA"; ControlEntry controlB = form.FindControlEntry("B"); controlA.Value = "TestA"; ControlEntry controlB = form.FindControlEntry("B"); controlB.Value = "TestB"; ; controlB.Value = "TestB"; |
Warning |
---|
Objects, of any kind, that are part of a Flow cannot access the list of controls for the Flow. Attempted access of FormTypeEntry.ControlTypeFeed, FormTypeEntry.ControlTypeFeedLink, FormEntry. ControlFeed, or FormEntry.ControlFeedLink will result in a NotSupportedException. |
How do I submit a form?
First you have to get a hold of the form instance (see 'How do I create a form instance?). When you are finished editing your form, you may submit it as follows:
...
Code Block |
---|
FormEntry form = ...; SubmissionEntry submission = form.Submit(); using (Stream file = File.OpenWrite("C:\temp")) { submission.PrintFormInstance(file); } |
Warning |
---|
Printing objects of any kind that are part of a Flow is not supported and will result in a NotSupportedException. |
How can I save a form for working on later?
...
Now you have a new form named My Purchase Order Form and you have the purchase order element added to the Data Source pane in the Designer. Using the designer, expand the Data Source pane and click the plus button to auto-generate the form controls (note that the API will be expanded to support auto generating controls).
I added a DocumentType from a Schema to my FormType
...
. Why do I see two
...
DocumentTypes?
Every FormType always has 1 default DocumentType that cannot be removed. This is the DocumentType managed by and updated when controls from the palette are added or removed from the form. For this DocumentType the Delete() method will fail (you can check whether a DocumentType can be deleted or not using the entry's ReadOnly property).
...
Code Block |
---|
FormTypeEntry ft = ...; ft.DeployState = DeployState.Production; // or ft.DeployState = DeployState.Development; |
How
...
do I copy a form?
Copying entails inserting an existing entry into a feed. The key difference between this case and a regular feed insert() is that the entry being inserted already has an id: this will trigger a copy.
...