locked
Unable to display Plug-in exception (using C#) in multiple lines in CRM 4.0 RRS feed

  • Question

  • I am trying to display "Exception Message" in multiple lines for more clarity.

    Here is the line related to exception in my plug-in.

    throw (new ApplicationException(string.Format("Please fill-in the following required fields:\r\n{0}",emptyMandatoryFields)));

    I am getting the message in a single line even though I used "\r\n".
    I tried only with "\n" also without success.

    Is this an issue with CRM 4.0? Can someone help me on this?

    Tuesday, November 3, 2009 7:06 PM

All replies

  • try using Environment.NewLine


    For more information regarding this have a look at following

    http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx



    Tuesday, November 3, 2009 7:33 PM
  • try using Environment.NewLine


    For more information regarding this have a look at following

    http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx




    This doesn't work...  <br/> tag use also...

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Tuesday, November 3, 2009 7:59 PM
    Moderator
  • Mayank,

    It didn't work.


    Andriy,

    Do you have any solution for this problem?


    Thanks,
    Vasu
    Friday, November 6, 2009 7:09 PM
  • From what I can gather of your problem, you're attempting to perform a platform-based check to validate the contents of fields from within a CRM form.  Why not do this with Javascript from the form itself?  You could then easily make a multi-line alert() to notify the user of missing fields.  Alternatively, if you used the SetFieldReqLevel() function, the CRM UI would provide this alert for you and even identify the fields missing data.

    Example:

    crmForm.SetFieldReqLevel("custom_field",1);   // Sets the field as being 'Required' by the UI; Saves are blocked while the field is empty

    crmForm.SetFieldReqLevel("custom_field",0);   // Sets the field as being 'No Constraint' by the UI

    And the lesser useful:

    crmForm.SetFieldReqLevel("custom_field",2);   // Sets the field as being 'Recommended' by the UI; Makes a pretty, blue '+' next to the field
    Dave Berry
    Friday, November 6, 2009 7:47 PM
    Moderator
  • Hi ,

    Try to use the SoapException .

    Thank You

    Raghu
    Friday, November 6, 2009 10:26 PM