Trouble with extension point

Valentin CLOUP
Tera Contributor

Hi,

 

I'm having troubles understanding how extension point really works. I'm familiar with the concept, but after running a test from scratch in a brand new PDI, I find an explanation to the results I'm having.

 

I created a very simple Extension Point as follow :

 

ValentinCLOUP_0-1744297405831.png

 

With two implementation, created via the "Create Implementation" UI Action and with the same default order :

 

ValentinCLOUP_1-1744297557836.png

 

ValentinCLOUP_2-1744297578087.png

 

Now, when I run a script to call the extension points and use the process function, I'm expecting to have a work note on my target record (defined by the script, see below) with "Point 1" and "Point 2", but im getting three different work notes :

 

ValentinCLOUP_3-1744297905087.png

 

The script that I used to run the extension point :

 

var current = new GlideRecord("incident");
if (current.get("57af7aec73d423002728660c4cf6a71c")){
	var ep = new GlideScriptedExtensionPoint().getExtensions("VCLTest");

		var point;
		for(var i = 0; i < ep.length; i ++){
			point = ep[i];				
			point.process(current);
		}
		
		current.update();
}

I tried running this script both in Background Script and in a Business rule, same results.

 

I cannot explain why I have three worknotes instead of just one while I'm only doing one update.

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

Hi @Valentin CLOUP ,

This issue isn't specific to extension points by a side effect of how setting a journal field (work notes in your case) can result in duplicate entries in sys_audit and sys_journal_field.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1923828 describes the resolution. 

 

The property 'glide.history_set.pull_journal_entries_from_journal_table' was introduced to address issues caused by scripts like this. Set this to true to prevent duplicate comments.

 

For those who cannot enable 'glide.history_set.pull_journal_entries_from_journal_table', an alternative solution was introduced in PRB1826101. Set 'glide.split_journal_audit_records' to true

View solution in original post

1 REPLY 1

Kieran Anson
Kilo Patron

Hi @Valentin CLOUP ,

This issue isn't specific to extension points by a side effect of how setting a journal field (work notes in your case) can result in duplicate entries in sys_audit and sys_journal_field.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1923828 describes the resolution. 

 

The property 'glide.history_set.pull_journal_entries_from_journal_table' was introduced to address issues caused by scripts like this. Set this to true to prevent duplicate comments.

 

For those who cannot enable 'glide.history_set.pull_journal_entries_from_journal_table', an alternative solution was introduced in PRB1826101. Set 'glide.split_journal_audit_records' to true