You are viewing limited content. For full access, please sign in.

Question

Question

LF Client - Custom Toolbar button utilizing metadata values

asked on June 3, 2014

We have a client that is wanting a shortcut in the Laserfiche client directly to Laserfiche forms.

 

Is it possible to access the metadata of a selected document and utilize in the shortcut.

 

For example:

 

We are planning on having the url in a metadata field, this way when a user highlights the document in LF then clicks the shortcut it will take then directly to the correct form.

 

 

0 0

Answer

SELECTED ANSWER
replied on June 4, 2014

This Presales Place article is something similar to what you're asking for and might interest you.

2 0
replied on June 5, 2014

Thanks Eric, is it possible to access metadata against a document other than Tokens for Custom Toolbar Buttons.

 

For example, if I want to access the metadata field called "first name"

 

How would I do this?

 

Is it as simple as %(first name) or are we limited to the Tokens for Custom Toolbar Buttons.

 

0 0
replied on June 6, 2014

Unfortunately, you can't do that with tokens. You'll need to use a script.

0 0

Replies

replied on June 3, 2014

You can use the SDK (specifically, CAT) to add a custom toolbar button that opens a web browser and directs it to the forms URL.

 

This presentation has sample code for adding toolbar buttons. Check out the "CustomButtonManager" sample. The exe launched by the button would do something like this:

 

static void Main(string[] args)
{
    int hwnd = 0;
    int entryid = 0;
    for (int i = 0; i < args.Length; i++)
    {
        if (i == 0)
            hwnd = Int.Parse(args[i]);
        if (i == 1)
            entryid = Int.Parse(args[i]); // TODO: %(SelectedEntries) is comma separated for multiple entries

    }

    if (hwnd > 0 && entryid > 0)
        LaunchForms(hwnd, entryid)
}

public static void LaunchForms(int hwnd, int entryid)
{
    using (ClientManager lfclient = new ClientManager())
    {
        IEnumerable<ClientWindow> windows = lfclient.GetAllClientWindows(ClientWindowType.Main);
        foreach (ClientWindow window in windows)
        {
            if (window.Hwnd == (IntPtr)hwnd) // Found the window the button was clicked from
            {
                RepositoryConnection repoconn = window.GetCurrentRepository();

                ILFConnection pLFConnection = GetLFSOConnection(repoconn);
                ILFDatabase pLFDatabase = pLFConnection.Database;
                ILFEntry pLFCurrentEntry = pLFDatabase.GetEntryByID(entryid);

                ILFHasTemplate pLFHasTemplate = (ILFHasTemplate)pLFCurrentEntry;

                ILFFieldData pLFFielddata = pLFHasTemplate.FieldData;
                string formsurl = pLFFielddata.get_FieldAsString("FormsUrl");

                // Launch IE and browse to the url:
                System.Diagnostics.Process.Start(formsurl);
            }
        }
    }
}

public static ILFConnection GetLFSOConnection(RepositoryConnection repoconn)
{
    string strSerializedConnection = repoconn.GetConnectionString();
    LFConnection lfsoconn = new LFConnection();
    lfsoconn.CloneFromSerializedConnectionString(strSerializedConnection);
    LFDatabase lfdb = lfsoconn.Database;
    lfdb.GetEntryByID(1); // test connection
    return lfsoconn;
}

And your button would run this kind of command line:

 

"c:\path\to\your\launcher.exe" %(hwnd) %(SelectedEntries)

 

3 0
You are not allowed to follow up in this post.

Sign in to reply to this post.