Change field value dynamically after processing of some other fields

Ali Heristchian asked on July 14, 2014 08:32

I have a document type with A, B and C fields. How can I implement this functionality while creating or editing document -> C = A + B

Correct Answer

Adam Gitin answered on July 14, 2014 09:15

Hi, You could use object events (link).

You could check for after update and then check for the document type you want this functionality to work on.

something like this (in the class): .....

string docType = "myDocType.test";

public override void Init()
{
   DocumentEvents.Update.After += Document_Update_After;
}

...

private void Document_Update_After(object sender, DocumentEventArgs e)
{
   if (e.Node.ClassName.ToLower() == docType)
   {
       AnotherFunction(e);
   }
}
...

Hope this helps.

Adam @4Hilton

2 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on July 15, 2014 13:43

As Adam mentioned, the global events are the best place to handle those types of actions, not in webparts. This way you know it will happen for every event for that particular document type.

0 votesVote for this answer Mark as a Correct answer

Ali Heristchian answered on July 27, 2014 08:32

Thank you very much.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.