This is a public Forum  publicRSS


    Ammar Aldaffaie
    Line Break using the SOAP APIAnswered
    Topic posted July 3, 2018 by Ammar AldaffaieExpert 
    34 Views, 3 Comments
    Line Break using the SOAP API


    I'm using the SOAP API to add a new record (Contacts, Incidents, and Organizations) the data is coming from Access database and using C# to inserting it to the OSC, it is working as expected and I see all the information.

    I'm only having an issue with the line breaks or starting a new line.

    I tried \n and <br/> but that didn't work.

    I have a text area custom field and I need to add line breaks in the text, the text originally coming from a web page so I tried to replace the <br/> with \n but that didn't work.

    Any idea to add a new line to the text area so it shows as a new line when used in a workspace?

    Thank you 


    Best Answer

    Heena Karir

    Try replacing </br> with Environment.Newline in C#.





    • Heena Karir

      Try replacing </br> with Environment.Newline in C#.



    • Ammar Aldaffaie

      Hi Heena, Thank you for your help, I think I'm doing something wrong. Please see below my code.

      string theStringIncludeBR = "line1 <br/> line2  <br/> line3";

      GenericField customField = new GenericField(); = "TheFieldName";
      customField.dataType = DataTypeEnum.STRING;
      customField.dataTypeSpecified = true;
      string Ammar = theStringIncludeBR.Replace(Environment.NewLine, "<br/>");
      customField.DataValue = createStringDataValue(Ammar);

      I'm still getting the full value ion the text area field so the final result in the field is showing as "line1 <br/> line2  <br/> line3" all one line incuding the <br/> as a text in there.


    • Ammar Aldaffaie

      Hi Heena,

      Your solution worked, I was not doing correctly the first time.

      Also this worked as well  \r\n