Extension Point --- How it Work ?

Vincenzo
Tera Contributor

Hi all,

I have the requirement to extend the mapping of fields copied from case to an Incident when I creating it from the case.

So I have tried to edit the extension point "CSMIncidentIntegrations" thinking that it will be used as an extension of the Script include, but it not work...

...could someone help me to understand how the extension point work?

 

My idea:

The UI Action trigger:

new sn_cs_sm.ServiceManagementIncidentUtils().createIncidentFromCase(current, action);

The "ServiceManagementIncidentUtils" contains "getExtensions" :

createIncidentFromCase: function(caseGr, uiActionHandler) {
	var incGr = new GlideRecord("incident");
	var ep = new GlideScriptedExtensionPoint().getExtensions(ServiceManagementIntegrationConstants.CASE_INC_EXTENSION_POINT);
	//If there is any other new extension instance other than the OOB one, concat them together
	//The extension instance with higher order number would overwrite the one with lower order number
	for(var i = 0; i < ep.length; i ++){
		var point = ep[i];
		point.copyFieldsFromCaseToIncident(incGr, caseGr);
	}
	
	var incSysId = incGr.insert();
	caseGr.incident = incSysId;
	caseGr.update();
	gs.addInfoMessage(gs.getMessage("Incident {0} created", incGr.number));
	uiActionHandler.openGlideRecord(incGr);
	uiActionHandler.setReturnURL(caseGr);
},

in the Extension Point of "CSMIncidentIntegrations", in function "copyFieldsFromCaseToIncident" I have added:

	copyFieldsFromCaseToIncident: function(incGr, caseGr) {		
		incGr.description = caseGr.description;
    },

But the system doesn't map the field...

..I have tried also to add gs.info ('------GO------');

But I haven't found anything in the LOG...

 

 

...could someone help me to understand how the extension point work?

Best Regards

Vincenzo\

1 ACCEPTED SOLUTION

Vincenzo
Tera Contributor

Hi,

I have found why my Extension Point are not triggered by the system...

...the problem was that for active on the system the Extension Point, you need to click the link "Create Impementation"

 

find_real_file.png

 

Now it work correctly.

 

Best Regards

Vincenzo

View solution in original post

9 REPLIES 9

Sebastian R_
Kilo Sage

I have currently no instance with CSM. Did you change the function in the extension point directly (Field Example)?

You have to change the Implementation part (related list on extension point). This is an Script Include.

If the script include is protected you have to copy the Script Include, deactivate the old extension point implementation and create a new one.

Christian_
Tera Guru

Hello,

An option here is to start debugging, to be able to see whats not working as you expect.

Have you looked into this one : Using extension points to extend application functionality ?

 

Vincenzo
Tera Contributor

Hi,

I have found why my Extension Point are not triggered by the system...

...the problem was that for active on the system the Extension Point, you need to click the link "Create Impementation"

 

find_real_file.png

 

Now it work correctly.

 

Best Regards

Vincenzo

Steven Chaparro
ServiceNow Employee
ServiceNow Employee

Hey @Vincenzo,

Did you tried to first create the implementation, and then configure the script include being created? or did you just modified the extension point first and then created the implementation?