Skip to main content
2 of 5
added 209 characters in body
Arai Yuhei
  • 961
  • 4
  • 10

Set General Field on a Component to specific word when the Component is saved

I want to set a General Field (Simple Text Field) on a Component to specific word (ex. "aaa") when the Component is saved, by using Event System.

I success to do the above, but I have one problem.

If the General Field is not Mandatory, it's no problem.

But if the General Field is Mandatory, it's problem, that is, the component isn't saved because of displaying error message "Mandatory field "xxx" is missing a value".

One solution is I set the General Field to not Mandatory.

But I want to set the General Field to Mandatory.

So please tell me a solution, that is,

how to set a General Field to specific word before SDL Tridion check whether the General Field is missing a value or not, using event system.

UPDATE

the below code is a part of all my code. the EventPhases is initiated.

EventSubscription subScription = EventSystem.Subscribe<Component, SaveEventArgs>(copy, EventPhases.Initiated);
Arai Yuhei
  • 961
  • 4
  • 10