Menu

itop-object-copier: How to insert new line \n ?

2025-04-02
2025-04-16
  • Björn Rudner

    Björn Rudner - 2025-04-02

    I am trying to use 'itop-object-copier' to generate a template-text in the description field.
    According to the documentation I can use \n to insert a new line. (https://www.itophub.io/wiki/page?id=extensions:itop-stencils)
    I configured this in the General Configuration / configuration file editor:

    3 => 'set(description, This is line 1 \n This should be line 2)',
    

    After safeing the file this always get converted to:

    3 => 'set(description, This is line 1 \\n This should be line 2)',
    

    and as a result the description field contains the following, instead of a new line:
    This is line 1 \n This should be line 2

    Next, I edited the file directly in the file system and saved it and it looks alright in the configuration file editor ( only \n )
    But even now there is no new line in the description, it still shows: This is line 1 \n This should be line 2

    Am I missing something?

     
  • Björn Rudner

    Björn Rudner - 2025-04-04

    Yes. But according to both documentations the \n should give a new line, but it didn't.

     
  • Vincent @ Combodo

    You're right, I have never used this feature.
    What is your iTop version?
    Has it been working in a previous iTop version?
    I suspect that this is a side effect of the 3.2.0, in which we have replaced the CKEditor version.

     
  • Björn Rudner

    Björn Rudner - 2025-04-04

    I am on 3.2.1 - I have not used the feature before.

     
  • Vincent @ Combodo

    Ok, I have investigated and found some info.
    1. "\n" does not work if you use it on an HTML field such as "UserRequest.description", it is designed for TEXT field, such as the Location.address field for eg.
    2. When you edit the Configuration file, in order to avoid \n when saving, use this syntax with double quote around your action instead of simple one
    or use real line return as this is how iTop will save it at the end

          2 => 'append(address,
    38000 
    Grenoble)',
    
    1. For HTML field just use HTML tags, it works
    3 => 'append(description,<ul><li>toto</li><li>titi</li></ul>)',
    
     
    👍
    2
  • Björn Rudner

    Björn Rudner - 2025-04-16

    Using HTML tags did the trick! Thank you!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.