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

@D V Sandeep 

the script I shared already has function to checkout cart

is that not working?

💡 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 
No, it is not check out the cart, may be because of 'two step checkout model'.
But I had modified and used the below record producer script, it is working but the other items in the cart also getting checked out. We need to check out only our catalog item which was created from our record producer at that time.

Record producer script:

var cart = new sn_sc.CartJS();

var item = {

    'sysparm_id': 'eed00879dbb200106388f53a29961920',

    'sysparm_quantity': '1',

    'variables': {

        'u_sysid': '925d130f93db16906806797efaba1041',

        'u_username': 'test@gmail.com',

        'u_access_action': 'Add',

        'u_access_name': '1725 demo test1',

        'u_access_id': '91500b6add7749f7a3aa772cb586120e',

        'u_access_type': 'ACCESS_PROFILE',

        'requested_for': '925d130f93db16906806797efaba1041'

    }

};

 

// Add item to cart

var cartDetails = cart.addToCart(item);

gs.info("Cart add details: " + JSON.stringify(cartDetails));

 

// Force checkout (bypass two-step checkout)

var checkoutInfo = cart.checkoutCart(true);

gs.info("Forced checkout info: " + JSON.stringify(checkoutInfo));

 

var requestSysId = checkoutInfo.request_id;

 

if (!requestSysId) {

    gs.warn("Request ID not returned — checkout may have failed.");

}

producer.portal_redirect = "sp?id=sc_request&table=sc_request&sys_id=" + requestSysId;

@D V Sandeep 

if you checkout cart all items will be submitted

I believe you can't submit selectically

Also why should that user who is submitting record producer should have other items in cart?

is that user supposed to have?

💡 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 
I was just thinking of a scenario where a user might have other items in their cart. In that case, I want to make sure that submitting our item doesn’t impact the other items in the cart and only our item gets submitted.

@D V Sandeep 

I don't think it's possible

💡 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