Highlighted
Absent Member.. Absent Member..
Absent Member..
455 views

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

Jump to solution

Hello folks,

I'm writing what I think it's a very simple code to add the contact.name 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+" "+contact.name 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. 

Thanks!

Ulises

 

 

Tags (1)
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

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

Jump to solution

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 -->.

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

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

Jump to solution

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.

e.g.

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+contact.name in $file + "<userid confirmed>"

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

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

Jump to solution

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

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

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

Jump to solution

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 -->.

View solution in original post

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

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

Jump to solution

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!

Regards,

Ulises

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.