Procurement Operations Management-Off-Catalog Record Producer/ NonCatalogIntakeService() Issues

Christine35
Tera Expert

*** I am running Utah***

 

Hello:

 

I attempting to use the "I need a product" off-catalog record producer in Employee Center.  Unfortunately, when I hit submit, the error message "You do not have permission to see this category" is returned, and in the resulting URL, the sys_id of the resulting Sourcing record is undefined - although a sourcing Record is actually created. (Resulting URL is: https://xxxdev.service-now.com/esc?id=sc_home&is_new_order=true&table=sn_shop_sourcing_activity&sys_...  I've tried to run the record producer via the Service portal, and while the error message is not returned, the sys_id is still undefined. 

 

I've read various articles, and completed the online Procurement Operations Management training, and spent a great deal of time trying to track down the issue. I've run the NonCatalogIntakeService() script include (called from the "I need a product" record producer) in a background script, and it does return the sys_id of the sourcing record created. I'm not sure why, when called from the "I need a product" record producer, the NonCatalogIntakeService() script does not correctly return the portal. One guess is that the portal may not wait for the script to return.

 

I've copied the "I need a product" record producer script below. As a further issue, when submitted, neither the producer.redirect or producer.portal_redirect (final lines of the script) seem to take effect.   Also, the sourcing request does not appear under "My Requests" in either the ESC or SP portals.

 

I would really appreciate any help with this. Thank you.

 

Christine

 

current.setAbortAction(true);

var payload = {
"product_type": "good",
"business_owner": new ShopNowGlideSessionHelper().getShopAsUser(),
"submitted_by": gs.getUserID(),
"status": "pending_review",
"employee_requirements": producer.employee_requirements,
"specific_requirements": producer.employee_requirements,
"supplier_product": producer.supplier_product,
"purchase_reason": producer.purchase_reason,
"url": producer.url,
"generated_sr_sys_id": current.getUniqueValue(),
"sourcing_request_details": ""
};

//Extract supplier details from variable sets
var suppliers = [];
JSON.parse(producer.existing_supplier_list).forEach(function(supplier) {
suppliers.push({
"sys_id": supplier.sys_id,
"legal_name": null,
"contacted": supplier.contacted
});
});

JSON.parse(producer.new_supplier_list).forEach(function(supplier) {
suppliers.push({
"sys_id": null,
"legal_name": supplier.legal_name,
"contacted": supplier.contacted_new
});
});

payload.suppliers = suppliers;

var nonCatalogIntakeService = new NonCatalogIntakeService();

if (producer.i_need_a_quote || producer.this_is_a_proof_of_concept) {
if (producer.quantity_option == "quantity")
payload.quantity = producer.quantity_amount;

if (producer.quantity_option == "amount")
payload.budget = producer.select_the_currency_type + ";" + producer.maximum_budget_amount;

if (producer.when_do_you_need_this_product == "as_soon_as_possible")
payload.expected_delivery_date = new GlideDateTime().getDate();

if (producer.when_do_you_need_this_product == "a_specific_date") {
payload.purchase_type = ShopConstants.LINE_TYPE_STANDARD;
payload.expected_delivery_date = producer.expected_delivery_date;
}

if (producer.when_do_you_need_this_product == "i_am_not_sure") {
payload.purchase_type = ShopConstants.LINE_TYPE_BLANKET;
payload.start_date = producer.start_date;
payload.end_date = producer.end_date;
}

if (!gs.nil(producer.recipient))
payload.recipient = producer.recipient;

if (producer.delivery_option == "saved_address")
payload.delivery_location = producer.look_up_one_of_your_saved_addresses;

if (producer.delivery_option == "office_location")
payload.delivery_location = nonCatalogIntakeService.getDeliveryLocationForOffice(producer.recipient, producer.look_up_an_office_location);

if (producer.delivery_option == "another_address")
payload.delivery_location = nonCatalogIntakeService.createNewDeliveryLocation(producer);
}

if (producer.need_info)
payload.sourcing_request_details = producer.info_required;

if (producer.i_need_something_else)
payload.sourcing_request_details = payload.sourcing_request_details + " " + producer.something_else_details;

if (new GlidePluginManager().isActive('com.sn_spend_ppm')) {
var purchaseReason = payload.purchase_reason;
var projectId = producer.ppm_project;

if (!gs.nil(projectId)) {
payload.ppm_project = projectId;

var updatedPurchaseReason = sn_spend_ppm.PSMProject.getUpdatedPurchaseReason(purchaseReason, projectId);
payload.purchase_reason = updatedPurchaseReason;
}
}

var result = nonCatalogIntakeService.request(payload);

producer.redirect = "/sn_shop_sourcing_activity.do?sys_id=" + result.sourcing_sys_id;
producer.portal_redirect = "?id=ticket&table=sn_shop_sourcing_activity&sys_id=" + result.sourcing_sys_id;

0 REPLIES 0