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

Question

Question

Custom client button that passes Form info

asked on March 2, 2016 Show version history

Does anyone know if how I might go about calling a Form from a custom button in the client?  I know how to call the form and even fill in info, but the info I need is part of something else.  So for example, here is the code behind the button:

"C:\Program Files\Internet Explorer\iexplore.exe" "http://servername/Forms/VATS-Invoice?invvendoraccountno=1234"

This works just fine, it passes 1234 to the form field invvendoraccountno.  However what we want to pass is not hardcoded it is a variable in the foldername.  So replace 1234 with %(FolderName)

However the number we want to pass is the last part of the name.  Here is a sample folder name:

Awarded: 3/2/2016, 1000.00, 1000.00, 1600000038

I want the 1600000038 and not the whole thing.  It does not seem I can do pattern matching or token edits from inside the custom button screen.  I need to pass this number to the Form and the Form will then do a lookup off this number and fill in many of the fields.

I did do a workaround a created a Business Process.  This workflow simply retrieves the field information on the folder (it is there as well as the in the name), does an Invoke Business Process activity to the Form we want, and passes everything along and creates the task for the Initiator.  However it does not launch the Form.  Our client wants the button to open up the Form and all the business process can do is create the task for them.

Any ideas or would this be some kind of custom program?

I suppose I could pass the whole thing to a hidden field and then use jquery to get that number and pass it to another field...  Was wondering if there was something a touch easier.

Thanks,

Chris

 

0 0

Replies

replied on March 2, 2016

This requires writing an application that is called from the toolbar button. The simplest custom application would just parse the folder name and use that to form the url that is opened with a web browser. You can also use the Laserfiche SDK to retrieve more information about the current folder (e.g. field values) using the CAT library. You can find more information in this presentation

0 0
replied on March 2, 2016

You could do this with a (relatively) simple script:

LaunchForm()

Sub LaunchForm()
	Set objArgs = WScript.Arguments

	if objArgs.Count <> 1 Then
		MsgBox "Invalid arguments", vbInformation
		Exit Sub
	End If

	FolderName = objArgs(0)
	Delimiter = " "

	MyArray = Split(FolderName, Delimiter, -1, 1)
	if UBound(MyArray) <> 4 Then
		MsgBox "Invalid folder name '" & FolderName & "'", vbInformation
		Exit Sub
	End If

	url = "http://servername/Forms/VATS-Invoice?invvendoraccountno=" & MyArray(4)

	Set WshShell = WScript.CreateObject("WScript.Shell") 
	Return = WshShell.Run("iexplore.exe " & url, 1) 
End Sub

Save this as c:\LaunchForms\LaunchForms.vbs and make your custom button call  wscript c:\LaunchForms\LaunchForms.vbs "%(FolderName)"

0 0
replied on March 3, 2016 Show version history

Robert, thank you for posting a script.  We were able to do some jquery.

Basically we just created a field on the form that the button passed the whole folder name to.  This field is hidden.  Then the below code does our regular expression and copies the result to the field that we have showing.

 

$('#q67 input[name="Field67"]').on('blur',function() {
    var objRegExp = /\d*.$/;
    var test = $('#q67 input[name="Field67"]').val();
    var result = test.match(objRegExp);
    $('#q28 input[name="Field53(1)"]').val(result);
});

However we are running into another problem that you can maybe help with.  The field we are copying the value to is a Lookup field.  This field should populate other fields.  This does not seem to be working.  The value is put there and it is the correct value but no other fields fill in.  The below screenshot shows that the Benefit ID is being passed from the jquery:

The 1600000038 is coming from the folder name of Awarded: 3/2/2016, 1000.00, 1000.00, 1600000038 so the jquery is working.

If we simply manually type in 1600000038 to the field the other fields populate (lookup rules work).  It seems that the Form is not recognizing that the field is being populated if we have query put something there.

Thanks,

Chris

 

Edit:  We ended up using your script so thank you.  It would be great to still get a possible answer to the lookup question.  If we can find a way around that we don't need to have a vb script and manage another file.  Can just be done through the form.

0 0
replied on March 7, 2016

Ok, so we have tried many different ways and are still not able to get the Form lookup field to trigger based off the value passed to a field.  We even modified the script you posted to javascript.  We know that it is working:

We have the javascript getting the folder field and successfully parsing off the 1600000041 and putting it in the Benefit Award ID.  However, this is still not triggering a lookup.  If we copy the number, delete it, paste it back in, the lookup works.  Any ideas?  Here is the code.  There needs to be some kind of field trigger or change but we have tried those and nothing seems to work.

 

 

0 0
replied on March 7, 2016

Try triggering a blur on the input element after setting its value.

0 0
replied on March 7, 2016

We tried that as well.  Still not luck.  However if we cut and paste the value back in, it then does the lookup:

 

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

Sign in to reply to this post.