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

Question

Question

Workflow: setting version comment

asked on January 22, 2015

I have a WF that changes some data on an entry that is already under version control.

I would like to fill the comment field of the new version that is created after the WF has run.

I tried the new "Verson Control" tool inside the WF but no comments appears in the new version.

 

How can I do ?

0 0

Answer

SELECTED ANSWER
replied on January 22, 2015

There currently is no way for the built-in activities to set version comments when updating fields. You would have to write a script to set the fields and version comment before saving the document.

0 0

Replies

replied on March 16, 2015

Hi Minura,

 

Do you have this script to set fields and comments through Workflow?

 

Thanks,

 

0 0
replied on March 17, 2015 Show version history

Workflow 9.1 or higher, assuming the entry is already under version control:

            EntryInfo EI=this.BoundEntryInfo;
            FieldValueCollection FVC=EI.GetFieldValues();
            FVC["FIELDNAME"] = "FIELDVALUE";
            EI.Lock(LockType.Exclusive);
            EI.SetFieldValues(FVC);
            EI.Comment="COMMENT";
            EI.Save();
            EI.Unlock();

Edit: replaced 

FVC.Add("FIELDNAME","FIELDVALUE");

above with

FVC["FIELDNAME"] = "FIELDVALUE";

because Add only sets the field value if the field is not already part of the template assigned to the document (and does nothing if the field is already on the document).

1 0
replied on March 17, 2015

Thanks Minura!

 

Andres

0 0
replied on July 2, 2015

Hi Miruna,

Can you help me please? I have the same issue but for me it's static documents and I do not want them to be under version control is it still possible to use the script that you've put? What my client want is to have an auto number generated on each comment field that we have in the metadata template.

Thanks,

Ketsia

0 0
replied on July 2, 2015

You can use the part of the script that sets fields, but why would you when Workflow has a built-in Assign Field Values activity?

0 0
replied on September 19, 2020

This solution is great!  As I work to expand our use of it, I'm struggling with the syntax to insert a token as the comment.  How would this be done?  Thank you

0 0
replied on September 21, 2020

I figured it out. 

Should anyone else need to insert a token as a comment rather than static text, line 7 should read like this: 

EI.Comment= TokenReplace("%(Insert your token name here)");

Thanks

0 0
replied on June 7, 2021 Show version history

Hi everyone,

 

Does anyone know what you need to update the Label section of the comment to? I thought it would be something simple like "EI.Label" like this but it doesn't exist...

 

            EntryInfo EI=this.BoundEntryInfo;
            FieldValueCollection FVC=EI.GetFieldValues();
            FVC["FIELD NAME"] = "VALUE";
            EI.Lock(LockType.Exclusive);
            EI.SetFieldValues(FVC);
            EI.Label= "Test";
            EI.Comment= TokenReplace("%(Version Comment)");
            EI.Save();
            EI.Unlock();

Thanks in advance!

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

Sign in to reply to this post.