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

Question

Question

Dropping fields using workflow that are not on a template

asked on August 21, 2019

So I believe I have tried every iteration possible to get rid of some fields on a document.

We are on Laserfiche 10.4.

I have a document with a template and some required fields.  I also have 3 fields on the document that are not part of the template (Step URL, Form Name, History).  These are used during a workflow process.  At the end of the process I simply want to get rid of Step URL and Form Name.... keeping History field and the template. 

What is the order in workflow to get this accomplished.

All of this is using Assign Fields Values.

1. Keep current template and set the two independent fields to null.

This works and clears the fields but I cannot check the box that says Remove fields from unassigned templates.

2. Next I try re-assigning the same template is already has with the box checked.

This does nothing to the document.  The template still has the two fields cleared

I have also tried to retrieve all the values, keep the template, clear all the fields, unassigned the template, check the box, and re-apply the template but I can't clear the original because of required fields.

Is there some kind of trick here to get rid of two fields?

Thanks

1 0

Answer

SELECTED ANSWER
replied on September 6, 2019 Show version history

This was identified as a change in feature introduced by Laserfiche in Workflow 10.4.1.

This issue does not present itself when doing a clean install of WF 10.4.1, but results when upgrading to WF 10.4.1 from previous versions. This issue also only applies to newly-created "Assign Field Values" activities AFTER upgrading (previously-existing field removals will still work after upgrading).

To correct this issue, when creating an "Assign Field Values" activity to remove a field ("Keep Current Template" option and specifying the field with a blank value), then go into the Advanced Options of that activity (gear icon in upper-right corner of Properties pane when that activity is selected).

 

 

In the Advanced Options view, there will be a checkbox for "Override default values when setting blank field values"; you must UNcheck that box, then republish your Workflow.

 

 

Remember to republish the Workflow, as it will not register it as a change and prompt you to republish before running.

This should correct the issue and allow the specified field to be removed from the metadata.

 

6 0

Replies

replied on August 21, 2019

You can remove non-template fields from an entry by setting them with blank values in the workflow. The first approach you listed should be correct. What was it not doing that you wanted?

The "remove fields from unassigned template" option does not remove all non-template fields, it only removes the fields that were associated with the previous template, assuming they are not part of the new template (the key word there is the "unassigned" template).

 

0 0
replied on August 21, 2019

I am clearing the values on the two fields (step url and form name).  I then want to remove those two fields from the document.  It is clearing the values in them but no matter the combination of choices and checkboxes I cannot seem to remove them.

0 0
replied on August 21, 2019 Show version history

That's interesting. I have several processes that blank out fields to remove them from a document and haven't had this issue.

Is there any chance they were added manually by a user at some point before this process, or were they added to the document by Workflow?

The reason I ask is that you can add blank non-template fields using the client, but as far as I know Workflow isn't supposed to do that.

0 0
replied on August 21, 2019

Nope, I am doing it myself.  I apply the template, and then add the 3 fields.

I then run my workflow on it to (try) and clear two of the three fields and remove them.  This is just a dummy workflow to test how to actually do it.

What are the steps you use using Assign Field Values?

I have keep the template and clear the fields (cannot select remove fields from unassigned templates)

Then I have Assign the following template since that is the only way to check the box.  I am reassigning the same template it already has.  It does not remove the cleared fields.

0 0
replied on August 21, 2019

When you add the fields yourself, are you entering values?

0 0
replied on August 21, 2019

Yes, the values of the two fields are filled out at the beginning and then change during the workflow.

0 0
replied on August 21, 2019 Show version history

To re-create:

- Put a template on a document with some data.

- Stick two extra fields on that document with some data

- Try and use workflow to clear and remove one the extra added fields and leave the other and the template.

0 0
replied on August 21, 2019

To answer your question, all I do to clear the values is the same thing you showed in item 1. I set them equal to blank values and keep the current template.

The second step won't change anything because you're keeping the same template and the checkbox only applies if a different template is assigned.

0 0
replied on August 21, 2019 Show version history

I believe that ever since Laserfiche has allowed blank independent fields on entries, workflow has functioned as Chris is stating; the document keeps the field assigned with a blank value.

The only way I know of to remove the blank independent fields is to use an SDK script activity.  So use the Assign Field Values activity to clear the values and then use a SDK Script activity to remove the blank independent fields.

 

2 0
replied on August 21, 2019 Show version history

Unless they changed something in 10.4 that shouldn’t be the case. I have processes currently running in 10.4.1 workflow with LFS 10.3 and it still drops non-template fields set to a blank value by Workflow.

It was my understanding that only the client, and not Workflow, could be used to save non-template fields with no value since the client has the checkbox option for removing the field entirely.

0 0
replied on August 21, 2019

Thanks for the script Bert, I will check it out.  Jason, if you have a workflow that does it I'd be curious to see a screenshot of the steps you do to verify if I am simply missing something.

0 0
replied on August 21, 2019 Show version history

I only set the field to an empty value like you did in step 1.

I even created a "bare bones" version today to confirm that's all that is needed and the following worked for me to remove the target independent field regardless of whether it was added manually or by another workflow.

0 0
replied on August 22, 2019

I too created a minimal workflow to clear/remove independent fields on my test system, and it would not remove the independent field(s) by just clearing them.  I had to use a SDK Script activity to actually remove the empty independent field(s).

My test system is running LFS 10.4.1.350 and WF 10.4.1.223

0 0
replied on August 22, 2019

Interesting, so it seems like it may have changed in 10.4

If so, I'm going to need to update a lot of workflows before we upgrade.

0 0
replied on August 22, 2019

If you have Rio, create a test server with 10.4 to verify.

0 0
replied on August 22, 2019

We have a test environment that we'll be updating to 10.4 relatively soon. I'll be testing everything there to see if I need to make any changes in production.

0 0
replied on September 2, 2020

I believe that ever since Laserfiche has allowed blank independent fields on entries, workflow has functioned as Chris is stating; the document keeps the field assigned with a blank value.

The only way I know of to remove the blank independent fields is to use an SDK script activity.  So use the Assign Field Values activity to clear the values and then use a SDK Script activity to remove the blank independent fields.

 

Bert, would you be willing to share that script on the forum?

0 0
replied on August 23, 2019

Hi all,

I have just upgraded from 10.3 to workflow and server 10.4.1 and i am having the same issue. i had started a workflow prior to the upgrade and I am trying to finish it now. All the approval fields I added prior to the upgrade are still working as usual: once workflow clears the field, it no longer display in the fields tab. However all the new fields I added after the upgrade, once cleared are still displayed.

In the picture below, the field Notice (added to the workflow after the upgrade) should not be showing blank but should have been removed  from the fields tab. This document was processed and two other fields were added and removed through the approval process via the assign fields activity (fields were added to the workflow before the upgrade).

 

0 0
replied on September 2, 2020 Show version history

I'm having the same issue; un-checking the indicated checkbox does not work for me.

0 0
replied on September 2, 2020

The supplied solution by Dustin Forster works to remove the empty Fields without using a SDK script activity.

0 0
replied on September 2, 2020

You must remember to publish a new copy of your Workflow, replacing the current copy, after making that change.

 

Workflow will not automatically register the un-checking of that box as a change, and will not prompt you to publish your changes before closing the Workflow. However, you must manually re-publish your Workflow for the changes to take effect.

0 0
replied on September 2, 2020 Show version history

I see the problem.  I'm using 10.4.0.131, looks like we need to update to 10.4.1

0 0
replied on September 2, 2020

Here is the code I used in a SDK Script activity to remove any blank independent fields:

            ' Lock the Entry for modification
            BoundEntryInfo.Lock(LockType.Exclusive)
            Try
                ' Create a list to hold field names to remove
                Dim lstRemove As List(Of String) = New List(Of String)
                ' Get the collection of Fields from the entry
                Dim fvc As FieldValueCollection = BoundEntryInfo.GetFieldValues()
                ' Check each field
                For Each sField As String In fvc.FieldNames
                    ' Check if value is null
                    If fvc.Item(sField) Is Nothing Then
                        ' Only remove independent fields
                        If fvc.IsIndependent(sField) Then
                            ' Add Field name to remove
                            lstRemove.Add(sField)
                        End If
                    End If
                Next
                ' Process list to remove
                For Each sField As String In lstRemove
                    ' Remove each field in list
                    fvc.Remove(sField)
                Next
                ' Write changes to entry
                BoundEntryInfo.SetFieldValues(fvc)
                ' Save changes
                BoundEntryInfo.Save()
            Catch ex As Exception
                ' Report error to Workflow
                WorkflowApi.TrackError(ex.Message)
            End Try
            ' Unlock Entry
            BoundEntryInfo.Unlock()

 

4 0
replied on September 2, 2020

Thank you Bert!  That is extremely helpful, and gives me something to use until we update our version.

0 0
replied on March 1, 2023

Thanks, Bert! This is going to help with an upgrade project I have with some old, messy files.

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

Sign in to reply to this post.