Auto Submit Cart Item from SailPoint Access Request Record Producer (Two-Step Checkout Enabled)

D V Sandeep
Tera Contributor

Hi Team,
We installed 'SailPoint Identity Security Cloud Service Catalog' plugin and configured its connector. As part of the plugin, we received the “SailPoint Access Request” record producer and the “SailPoint Service Catalog” catalog item.

With the out of the box behavior when a user submits the record producer, the selected data i.e., Requested for, Application, Access Type, Access Profile.. values are copied into the SailPoint Service Catalog item variables, and that catalog item is automatically added to the cart. However, the user must then manually navigate to the cart and click “Proceed to Checkout” to submit the request. Only after that step is the actual request created.

Our requirement:
When the user submits the record producer, the system should automatically submit (checkout) the generated cart item without requiring the user to manually go to the cart and click “Proceed to Checkout”.

FYI, our instance has two-step checkout enabled.

We are looking for suggestions or best practices to achieve this.
@Ankur Bawiskar 

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

@D V Sandeep 

when record producer is submitted it must be creating entry into some target table.

what happens after that?

share some screenshots etc

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 
Once record producer submits, the record is creating in the target and simultaneously the access request data copied over to catalog item variables and add the catalog item to the cart. Please refer the record producer script and attached screenshots.

Record producer script:

createAccessRequest();

function createAccessRequest() {
    if (producer.access_request) {
        let uiController, resultObj;
        uiController = new SPISCUIController();
        resultObj = uiController.submitRequest(JSON.parse(producer.access_request));
        if (resultObj.successful) {
            gs.addInfoMessage(gs.getMessage("Record created successfully. Refer {0} for more details.", resultObj.result));

            //copy attachments to generated RITMs
            var grSA = new GlideRecord('sys_attachment');
            grSA.addQuery("table_sys_id", current.getUniqueValue());
            grSA.query();
            if (grSA.hasNext()) {
                uiController.copyAttachments(current.getUniqueValue(), resultObj.result);
            }
        } else {
            gs.addErrorMessage(gs.getMessage("Record creation failed.") + " " + resultObj.result[0]);
            current.setAbortAction(true);
        }
    } else {
        gs.addErrorMessage(gs.getMessage("Request not validated. User Selection, Access Object Selection and Validation success to be completed."));
        current.setAbortAction(true);
    }
}

@D V Sandeep 

why not have your own script to submit the catalog request using CartJS API?

Don't use that OOTB logic

CartJS - Scoped 

something like this

try{
	var cart = new sn_sc.CartJS();
	var item =
		{
			'sysparm_id': '0336c34407d0d010540bf2508c1ed096',
			'sysparm_quantity': '1',
			'variables':{
				'user': '7282abf03710200044e0bfc8bcbe5d03',
				'asset': '00a96c0d3790200044e0bfc8bcbe5dc3',
				'multiple_choice': 'Phoenix',
			}};
	var cartDetails = cart.addToCart(item);
	var checkoutInfo = cart.checkoutCart();
	gs.info('Order details' + JSON.stringify(checkoutInfo));
}
catch(ex){
	gs.info('Exception'+ex);
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 
Still the item is sitting in cart, not submitting the item in the cart.
FYI, In our instance two step checkout model is enabled.