Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this page:

Table of Contents
maxLevel2

Note

In v9.1 and later frevvo's "Applications" are known as "Projects," and "Themes" are known as "Styles." The API objects and methods still use the words application, 'app', and theme.

...

Code Block
          FormsService service = new FormsService("http://localhost:8082", "yourappname");
          service.Login("myuser", "mypassword");
          UserEntry user = service.GetUser(“myuser”); 
                   
          // interact with frevvo
                   
          service.Logout();

Note that when you loginlog in, 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.

...

This 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 useful when you want to login log in using the same user that is logged into your project without having to know their password.

...

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.

...

Warning

All references to Themes have been removed in version 5.3. This example does not pertain to 5frevvo 5.3 or later.


Code Block
    FormsService service = ...;
    ThemeQuery query = service.CreateThemeQuery(null);
    ThemeFeed themes = service.Query(query);
    foreach (ThemeEntry theme in themes.Entries)
    {
            Console.WriteLine("Theme: " + theme.Title.Text);
    }

...

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 an ApplicationEntry for the first time can I get the entry directly?

...

Then using the designerUrl above you can generate the following script tag in on your html HTML page:

Code Block
<script type="text/javascript" src="{designerUrl}"></script>

...

Then using the formSubmissionsUrl above you can generate the following script tag in on your html HTML page:

Code Block
<script type="text/javascript" src="{formSubmissionsUrl}"></script>

...

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:

...

Then using the formInstanceUrl above you can generate the following iframe tag in on your html HTML page:

Code Block
  <iframe   src="{formInstanceUrl}"/> 

...

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:

...

Then using the formInstanceUrl above you can generate the following script tag in on your html HTML page:

Code Block
  <script type="text/javascript"  
  src="{formInstanceUrl}"></script> 

...

This is often needed when you need to relate a  form frevvo form with another concept of your application (e.g. you your application has the concept of a report that has an associated  formfrevvo 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):

...

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?.

...

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 it 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);

...

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 frevvo 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 formTypeEntry = ....; 

// request all data come back as part of the submit response
NameValueCollection linkParams = new NameValueCollection();
linkParams.Add("_formActionDocs", "true"); 

FormEntry formEntry = formTypeEntry.CreateFormEntry(linkParams); 

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;
} 


Functions only available in the .net api

...

for frevvo v5.3 or later:

Note

The updates listed here are only available in .net client API version 5.3 or later.

 Note the Themes api was removed and replaced by the Styles api in frevvo 5.3.  All references to Themes have been removed in frevvo 5.3.

...

There are three options when uploading a workflow or form: Insert, Copy or Replace. You can use a Stream or a file path location when uploading.

Code Block
string fileName = ....;
bool isForm = ....;
ApplicationEntry appEntry = ....; 

// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(filename, isForm); 

// If an entry with the same id already exists, a copy will be made.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(filename, isForm); 

// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(filename, isForm); 
 
Stream appStream = ....;
bool isForm = ....;
ApplicationEntry appEntry = ....;
 
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(appStream,isForm);

// If an entry with the same id already exists, a copy will be made. 
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(appStream, isForm);


// If an entry with the same id already exists, it will be replaced. 
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(appStream, isForm);  

...

Code Block
string signaturePictFile = ....;
string signatureXmlFile = ....; 
string sectionFormXmlFile = ....;
string miscFile = ....;
FormTypeEntry formTypeEntry = ....;   // existing form type from feed 
Stream wetSig = File.OpenRead(scriptStream);
Stream sigXml = File.OpenRead(signatureXmlFile);
Stream formXml = File.OpenRead(sectionFormXmlFile);
Stream miscFile = File.OpenRead(miscFile);

FormEntryBuilder fbe = new FormEntryBuilder(formTypeEntry);

fbe.Document("form", formXml);
fbe.WetSignature("controlTypeId", wetSig); 
fbe.DigitalSignature(sigXml); 
fbe.Attachment("controlTypeId", miscFile); 
fbe.Data("Name", "some name");  // builds up _data 
fbe.Parameter("_formTz", "America/New_York");  // adds URL param 
fbe.FormActionDocs(true);  // set _formActionDocs param to return Submission Doc Set

FormEntry formEntry = fbe.CreateFormEntry();

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;
}

Functions only available in the .net api

...

for frevvo v6.1.2 or later:

Note

The updates listed here are only available in .net client API version 6.1.2 or later.

...

Code Block
ApplicationEntry testApplication = ....;
SchemaEntry testSchema = ....;
string fileName = "\path\to\myschema.xsd";

MediaFileSource source = new MediaFileSource(fileName, SchemaFeed.MEDIA_SOURCE_TYPE);

testSchema = testApplication.SetupSchema(source, "schemaName-required"); 

Functions only available in the .net api

...

for frevvo v6.1.5 or later:

Note

The updates listed here are only available in .net client API version 6.1.5 or later.

...

 You can specify who receives an email reporting the upload status when it is done through the API. The email is sent to the "notificationEmailAddress" that is passed in the API. The email may say something like this if there are errors during the upload:

Code Block
Validation occurred with errors. Users data NOT loaded. Refer to attached CSV data file for validation and/or loading result details.

...

Ensure the form/workflow submissions you are trying to access has either the userid or Roles that the user is a member of in "Who can view submissions" ACL.

How do I use the Security Manager Built-In Admin?

LDAP, SAML, and SAML Azure Security Managers provide a built-in admin login directly to frevvo, which is helpful if your security manager logins should become inaccessible and you need to access frevvo.  This built-in admin is automatically enabled from the API when using SAML, but for LDAP it needs to be explicitly enabled by setting the custom property "backdoorLogin" to true in the loginAs call. This will allow the API to login in the same way a built in admin can

...

log in using /frevvo/web/admin/login.

Code Block
service.loginAs("loginAsUser", "adminuser@tenant"), "????", true, null, null, null, null, Map.of("backdoorLogin", "true"));

...