Format Control Question: Can anyone tell me what am I missing here?

Hello folks,

I'm writing what I think it's a very simple code to add the field at the end of the task title when certain condition is met.  So here's the code I came up with:

Format Control: cm3t

On add: (parent.category in $file)#"Service Catalog"

Calculation: brief.desc in $file=brief.desc in $file " " in $file

This works and it adds the contact mame at the end of the title in the task.  The problem is that this code keeps firing every time there is an update in the task, to you end up with a title like this:

This is the task title USERID USERID USERID...

So what am I missing here? I've tried everything from putting the condition in 'initial' instead of 'add' and rewriting the whole thing in JavaScript. 





  • Strange. I thought On Add only fires on creation of the new cm3t record. You could try the triggers to see if they work better or try this workaround. Add a special string to indicate the userid update has been done and to check for it before adding.


    On Add: Instr(0,brief.desc in $file,"<userid confirmed>",0)=0 and (parent.category in $file)#'Service Catalog"

    Calculation:breif.desc in $file=brief.desc in $file in $file "<userid confirmed>"

  • Jas1,

    Thanks for the suggestion! I couldn't use your code as written (for some reason the format control didn't like the expression), so I just wrote in Javascript this way:

    On Add: (parent.category in $file)#"Service Catalog"

    var n = system.vars.$file.brief_desc.indexOf("USER -->");


    if (n = -1 ) {

    system.vars.$file.brief_desc= system.vars.$file.brief_desc " USER --> " system.vars.$file.contact_name;;



    Guess what? it still does the same thing when I do an update on the task:

    This is a new task for USER --> USERID1 USER --> USERID1


  • Verified Answer

    Sorry. that Instr() was from Connect-IT. I got my notes jumbled up.

    The index function should work.

    You could try On Add: Index("<userid confirmed>",str(brief.desc in $file))<=0 and (parent.category in $file)#'Service Catalog"

    Or debug your script and print out the value of n  and system.vars.$file.brief_desc for the 1st add and the subsequent updates. See how the indexOf is working. Your script looks right from what I can see and the spaces will be ignored by the indexOf should be able to pickup your 1st string add. Maybe try removing the space between USER and -->.

  • Jas1,

    I think I know what the problem is; is not with the logic you proposed (or even the original one).  It has something to do with the way the system handles the task creation process via a template.  I realized this yesterday why trying to update the task title from the link record that sends the information from the parent change ticket.  

    Thanks a lot for your response!