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

Question

Question

Issue with the script to set version comment

asked on July 7, 2015

Hi Everyone,

I have the same issue as this answers link.

https://answers.laserfiche.com/questions/69895/Workflow-setting-version-comment

I am new to C# script coding and trying to use the script from Miruna's suggestion as following, but it does not work.

namespace WorkflowActivity.Scripting.Script
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;

    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : ScriptClass90
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            // Write your code here.
              EntryInfo EI=this.BoundEntryInfo;
              FieldValueCollection FVC=EI.GetFieldValues();
              FVC.Add("FIELDNAME","FIELDVALUE");
              EI.Lock(LockType.Exclusive);
              EI.SetFieldValues(FVC);
              EI.Comment="COMMENT";
              EI.Save();
              EI.Unlock();
        }
    }
}

 

How can I achieve the above,please suggest.

Thanks in advance.

0 0

Answer

SELECTED ANSWER
replied on July 7, 2015

You're using the wrong activity. You want a SDK script not a plain script.

1 0
replied on July 10, 2015

Hi Miruna,

      I need your suggestion, please. I 've used SDK script activity for setting version comment using your C# script.

My situation is I would like to coding a simple workflow as a business process and when this business process was started then entry was created under version control and  its field values should be modified after that  the script should set a comment of this modifying of the entry.

when I run the script, there is a error message appeared as following.

    And this is how I set starting entry.

I would like starting entry of this script is output of created entry without referring to any specific entry id or any paths.

How can I accomplish this without error?

Any advice would be greatly appreciated.

0 0
replied on October 27, 2016

I am a VAR and am testing something out for a customer.

I have a MS Word document that is already under version control and I need to have Workflow update the document's comments and the label.  I tried using Miruna's script exactly as the post above, and yes, I did use the SDK Script activity in Workflow.  My Workflow runs and completes without error or warning, but the comments and the field values are not updated. 

Script and workflow screen attached.  Do I need to have the Laserfiche SDK/Toolkit installed for this to work?

Appreciate any help.  Thanks

 

SDK_Script_-_set_version_comments.png
Set_Version_Comments_Workflow.png
0 0

Replies

replied on July 7, 2015

Thank you so much, Miruna.

0 0
replied on November 1, 2016

Hey Bongkoch,

 

You would be able to set the starting entry as the output of the "Create Entry" activity with the "Change Starting Entry" activity.   This allows you to set the starting entry reference to a file or folder referenced previously in the workflow.

replied on November 2, 2016

Hey Bongkock,

You're probably running into an error because you're trying to run the script from the editor and not the Workflow Designer.  Running the script from the script editor will attempt to assign a field value and version comments to an unspecified entry.  Try clicking the green play button in the workflow designer.  This will run all the activities in your workflow in order, creating a blank document and providing an entry for the script to act on.

 

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

Sign in to reply to this post.