-3

I have a plugin that update some custom fields and I want to run some javascript to validate the fields and present the user with an alert message if required.... is this possible (dynamics crm 4)

Thanks, Tim

Greg Owens
  • 3,878
  • 1
  • 18
  • 42
Tim Windsor
  • 319
  • 1
  • 5
  • 17
  • 2
    I'm sure you can elaborate your question a little more, right? – MilkyWayJoe Jun 25 '12 at 21:21
  • Hi Sorry for the lack of info. I simply have a plugin on the quote that retireves a maxium (combined) order value the account/contact can have at any one time, then retrieves the value of all open orders updating the custom fields on the quote window. I then want to prompt the user that the combined order value has exceeded the maximum order value (via javascript becuase there is no other way of displaying an alert type warning that I know of) thank you.. – Tim Windsor Jun 26 '12 at 19:59

1 Answers1

1

Well for a start, a plugin is server-side code and JScript is client-side. There can be no direct communication between the two - certainly not in the direction you suggest (plugin causing JScript to fire). If a workflow updates a record and causes the plug-in to fire, there is no (interactive) user to alert.

As @MilkyWayJoe suggests - you haven't given enough info in your question to help us answer it properly, however:

If you are suggesting that after the plugin fires, when a user next opens the record they are prompted to fill missing fields, then you would simply have some JScript attached to the form's onLoad event which checks the fields you specify and raises an alert. Read the SDK for more info (e.g. here and here).

Otherwise, (and in ignorance of your specific business requirements) I might suggest that the check for missing data is encapsulated in your plugin which raises an exception if the requisite fields are null.

Greg Owens
  • 3,878
  • 1
  • 18
  • 42
  • 1
    Following your clarification, I would suggest an additional custom attribute called something like "new_MaxValueExceeded" (checkbox). Add this as readonly on your form. Have your plugin set this value to true for any record where the alert should be raised. Have some plugin on load of your quote record (i presume this is where the alert should be raised) which looks at the value of the aforementioned field. If it is set to true, raises a JScript alert. – Greg Owens Jun 27 '12 at 08:15