Order Guide Create INC's and REQ's and set INC parent to the Created REQ Number

Dillin  Bradley
Tera Expert

Hello,

 

I have an order Guide that Creates a REQ with 4 RITMs attached to it, but it also creates an Incident as well. 

 

How can I get the INC created from the order guide to set its Parent Field to the REQ that also gets created form the order guide?

 

Thanks,

Dillin

2 REPLIES 2

kamlesh13
Tera Contributor

Hey @Dillin Bradley ,

 

if you want to set the "Parent" field of the Incident (INC) record to the Request (REQ) that is created from the Order Guide, you can do this using Business Rules or a Script Include.

 

1. **Identify the Trigger Point:** Determine when you want this assignment to occur. It could be when the Request is created or when the Incident is created.

2. **Create a Business Rule:**
- Navigate to "System Definition" > "Business Rules."
- Click "New" to create a new Business Rule.
- Provide a name and a description for the Business Rule.
- Set the "Table" to the target table (e.g., "incident" for INC or "sc_request" for REQ).
- Define the conditions under which the rule should run. For example, you might want to run this rule when a new INC or REQ record is created.

3. **Write the Script:**

(function executeRule(current, previous /*, gs */) {
    if (current.getTableName() === 'incident') {
        var reqId = current.u_request; // Adjust field name if necessary
        if (reqId) {
            var reqGR = new GlideRecord('sc_request');
            if (reqGR.get(reqId)) {
                reqGR.parent = current.sys_id;
                reqGR.update();
            }
        }
    }
})(current, previous);

 

Regards,
Kamlesh

AnveshKumar M
Tera Sage
Tera Sage

Hi @Dillin Bradley ,

 

Unfortunately this is not possible directly to map the request as parent to the Incident created via Record Producer in an Order guide.

 

 

Thanks,
Anvesh