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

Question

Question

Custom Activity read fields

asked on February 26, 2016

I've tried searching but can't find documentation on how to read the collection of fields available to an entry in a workflow custom activity. Could someone provide an example in C# code of how to do this?

0 0

Answer

SELECTED ANSWER
replied on March 2, 2016 Show version history

Kyle - This code snippet shows a couple of ways to retrieve field values from a document template;  (If you are looking for something more specific than this then please let me know)


//Create a new session and login...

{
	Session raSession = new Session[];
	raSession.LogIn(new RepositoryRegistration("SAMANTHA-PC", "LFMAIN"));

	//Get a reference to the document...
	DocumentInfo docInfo = Document.GetDocumentInfo(98300, raSession);

	//Field values can be retreived by fieldname if you know the template fieldname in advance...
	object author = docInfo.GetFieldValue("Author");

	MessageBox.Show("Author: " + author);

	//Field values can be retrieved as a collection (all field values)...
	FieldValueCollection fvCollection = docInfo.GetFieldValues;
	List<string> fieldList = new List<string>();

	//The fieldvaluecollection elements are keyvaluepairs...
	foreach (KeyValuePair<string, object> fv in fvCollection) {
		fieldList.Add("Fieldname: " + fv.Key + " Value: " + fv.Value);
	}

	MessageBox.Show(string.Join(Environment.NewLine, fieldList.ToList));

	//Cleanup...
	docInfo.Dispose();
	raSession.Close();
}
0 0
replied on March 3, 2016

Thanks for this Cliff! Would you be able to look at my question here for reading the fields from the 'Retrieve Field Values' activity?

https://answers.laserfiche.com/questions/93379/Read-token-collection-from-Retreive-Field-Values-activity

0 0
replied on March 3, 2016

Looks like Laserfiche jumped in with an answer, sorry for the delay...

0 0

Replies

replied on March 1, 2016

Anyone able to provide some assistance here?

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

Sign in to reply to this post.