Customer Widget opens a form in a modal overlay - How to force SP view

Andrew Bettcher
Kilo Sage

I have a customer widget that, when a user clicks a record, it opens the form in a modal overlay. However, it uses the default view of the form. It doesn't use a URL and so I can't simply modify that to force it to use a different view. 

 

Can anyone help me work out how to force it to use the sp view please?

 

This is the part of the client script that opens the record:

 

 

c.openRecord = function(record){
		
		c.modalInstance = $uibModal.open({
			//template: '<div class="modal-header" h4 class="modal-title">Record Name</h4></div>' +
			//'<div class="modal-body">{{ modalC.record | json }}</div>',
			
			templateUrl: 'swap-shop-item-overlay.html',
			controllerAs: 'modalC',
			controller: function() {
				
				var modalC = this;
				modalC.record = record;
				modalC.modalInstance = c.modalInstance;
				spUtil.get('widget-form', {
					sys_id:modalC.record.sys_id,
					table:c.data.table
				}).then(function(response) {
					modalC.form = response;
				})
				}	
		})

 

 

1 ACCEPTED SOLUTION

jrmarkel
Giga Sage

 

spUtil.get('widget-form', {
    sys_id:modalC.record.sys_id,
    table:c.data.table,

    view: 'sp'
}).then(function(response) {
    modalC.form = response;
})

View solution in original post

2 REPLIES 2

jrmarkel
Giga Sage

 

spUtil.get('widget-form', {
    sys_id:modalC.record.sys_id,
    table:c.data.table,

    view: 'sp'
}).then(function(response) {
    modalC.form = response;
})

Outstanding. Thank you. I'd tried something similar but wasn't sure of the syntax. 

 

Works a treat.