The scenario is this: When deactivating or reactivating and entity in CRM 4.0, change the value of a field in your form and save it to the db.
Long story short to achieve this goal you must do the following:
1. Customize the OnSave event of the form
2. Check the event.Mode value (remember that 5 is deactivate, while 6 is reactivate)
3. Change the DataValue property of your desired field to whatever you want
5. Throw in some ForceSubmit = true for good measure
So, your code for the OnSave event might look like this
Code:
if(event.Mode == 5/*Deactivate*/)
{
crmForm.all.yourField.DataValue = xxxxxx;
crmForm.all.yourFiled.ForceSubmit = true;
if(event.Mode == 6/*Reactivate*/)
{
crmForm.all.yourField.DataValue = yyyy;
crmForm.all.yourFiled.ForceSubmit = true;
}Enjoy:)
Niciun comentariu:
Trimiteți un comentariu