Create Request from Incident Business Rule

David Casper
Tera Guru

Having an issue creating a request from an incident through a Business Rule. I'm able to get the request and request item created, but I'm not able to copy any variables from the Incident to the Request Item. 

I would like to create a relationship between them or at least have the incident show in the 'Parent' field for reference. Once that is accomplished I might want to copy over other fields as well.

I'm creating the request with an after business rule and the following code:

createRequest();
function createRequest(current,previous)
{
var cart = new Cart();
var item = cart.addItem('fa593675db682380183464904b96198a');
var rc = cart.placeOrder();
gs.addInfoMessage('New/Update Configuration Item Request Created');
}

The business rule is triggered by a specific field being selected on the form. The business rule is triggering off the Task table since I'm going to want this to also apply to problems and changes. 

9 REPLIES 9

hey! sorry for the delay in my response, but we had our go-live last week. I've not had a chance to review and test your code yet, but I hope to in the near future. 

I'll make sure to let you know how it goes. 

sachin_namjoshi
Kilo Patron
Kilo Patron

You do not need to write custom business rule for creating request from incident.

There is OOB UI action "create request" available on incident table to create request from incident.

 

find_real_file.png

 

Regards,

Sachin

I need the request to be made automatically based on the value of a specific field on the form. I didn't this this would apply since it is a button that the user can choose.

You can copy code from UI action in your business rule.

 

Regards,

Sachin

Well as I said I'm able to get the request created, it's copying the variables which is the issue.