Versions Compared

Key

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

...

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

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.

...

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 = ...;
    ApplicationQuery query = service.CreateApplicationQuery(null);
    ApplicationFeed apps = service.Query(query);
    foreach (ApplicationEntry app in apps.Entries)
    {
            Console.WriteLine("App: " + app.Title.Text);
            // ...
    }

...

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.

...

Note
  • The method FormTypeEntry.CreateFormInstanceEmbed(NameValueCollection, params MediaSource[]) is only available in .Net Client API version 5.1 Patch 3 and later.
  • See this documentation for more information about available URL parameters.

 


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):

...

Note
  • The method FormEntry.SubmitInstance() will return null if the FormEntry was not created with the _formActionDocs parameter set to true.
  • The method FormEntry.SubmitInstance() is only available in .Net Client API version 5.1 Patch 3 and later.


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:

...

Note
  • The method FormTypeEntry.CreateFormEntry(NameValueCollection, params MediaSource[]) is only available in .Net Client API version 5.1 Patch 3 or later.
  • See this documentation for more information about available URL parameters.


How do I edit a form control?

Suppose you have a form with controls named A and B.  Further, suppose the form is initially empty, and you wish to programmatically set the control values to TestA and TestB respectively.  First you have to get a hold of the form instance (see 'How do I create a form instance?).

...

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?

...