- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 04:09 AM
Hi guys I currently have a problem, when I write a comment and I have a before business rule (comment changes), and I want to edit what was wrote in the comment field, when the business rule runs it duplicates the information as you can see:
Business Rule Conditions : Comments changes
(function executeRule(current, previous /*null when async*/) {
var comments_added = current.comments;
var merged = comments_added + "SAMPLE TEXT";
current.comments = merged;
})(current, previous);
Do you guys have any idea how can I changed the comment added to include more test ?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 05:34 AM
So what is happening is that "comments" on Task table and it's extensions is a special one, it's not really a field, but part of a formatter. So, playing with the business rule here is not the right way, as the comments update is actually doing an insert into the sys_journal_field and sys_audit. So if you would like a business rule, it should have been one on the sys_journal_field before insert. But even so, I would not recommend going that far.
What if you try a before onSubmit client script like:
Works for me at least.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 04:17 AM
Have you tried printing "merged" variable?
gs.log(merged)
I believe "merged" variable might hold an object rather than a simple string.
Can you try this:
var comments_added = current.comments.toString();
var merged = comments_added + "SAMPLE TEXT";
Also it's a before update business rule? What order is it? Must be last one I would expect.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 04:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 04:24 AM
Could you please tell me what is the use of last line of comments?
cur}})(current, previous);)(current, previous);rent.comments = merged;
Regards,
Souren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2017 04:46 AM
That was an error pasting It, it's correct in the code, sergiu.panaite I've tried with tostring I get the same result (order is 1)
BR :
I'm assuming if this won't work I need to get a client script going on submit maybe.