If the service offering is set to XXX the following XXX and YYY task templates should be deactivated

Community Alums
Not applicable

Hi All,

I have a requirement in service catalog like If the service offering is set to 'XXX' the following 'AssetCtask:Deliver/Install IT equipment'  task template should be deactivated. How it can be achieved?

Can we acheive it using OnSubmit Client Script?

Thankyou.

 

 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

I wrote a code on the Template Spawn hierarchy to make it work. It worked. Thankyou.

View solution in original post

11 REPLIES 11

Hi @hennessyD 

As per the author requirement, I do not see in his code where the check is made if the value of that variable is the one which he want to check.

So would suggest to use the code as shared below by me. And also the variable value will not be available in Trigger condition of the BR, so this may cause an issue with the BR running all the time I believe.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

shloke04
Kilo Patron

Hi,

What you can do here is Write a After Insert Business Rule on Requested Item table and use the script below:

BR Details:

Table Name : Requested Item

When: After Insert

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var getVariable = current.variables.VariableName; //Replace your service VariableName here
	if(getVariable == 'Check for your value here'){
		disableTemplate();
	}
	
	function disableTemplate(){
		var gr = new GlideRecord('sys_template');
		gr.addQuery('sys_id','Enter the Sys id of the template here');
		gr.query();
		if(gr.next()){
			gr.active =false;
			gr.update();
		}
	}

})(current, previous);

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Community Alums
Not applicable

Thankyou it does makes the AssetCtask template inactive in the backend. But I want the AssetCtask template get deactivated only for this condition and it should be active for other catalog items.

The AssetCtask template which is activated should  only run and close the RITM. Based on the condition if service offering is XXX it should not run using AssetCtask:Deliver/Install IT equipment'  task template and close the RITM. Thankyou

Community Alums
Not applicable

Thankyou it does makes the AssetCtask template inactive in the backend. But I want the AssetCtask template get deactivated only for this condition and it should be active for other catalog items.

The AssetCtask template which is activated should  only run and close the RITM. Based on the condition if service offering is XXX it should not run using AssetCtask:Deliver/Install IT equipment'  task template and close the RITM. Thankyou

Sure. You can handle this within the same Business Rule itself.

You just need to add a condition to your Business Rule which will ensure that the template gets deactivated only for this particular catalog item and not for all of them.

See Screenshot below where you need to add the conditions:

Item is Name of your catalog item

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke