sp-model

Kanika4
Tera Contributor

Can anyone help me in how to pass data to sp-model to populate a form ?

4 REPLIES 4

Siddhnath Pande
Mega Guru

Hello Kanika,

Assume you have table of incident on a widget every single row contain a incident record and last column contains a button, on which if you click then this will open a sp-model(incident form) to show more detail of that current record.

On click of that button "sys_id" of that row is passed to sp-model or you can say form of incident.

Here is the code please refer.

 

c.buttonClick = function($index)
{
var sys_id = c.data.array[$index].sys_id;
var table = "incident";
var data = sys_id + "####" + table;
$rootScope.$broadcast('sys_id',data);
}

c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}

 

 

If my answer was able to solve your query please mark it as Helpful & Correct.

Thank you

Siddhnath Pandey

Indrajit
Mega Guru

Hey Kanika, 

The spModal class provides an alternative way to show alerts, prompts, and confirmation dialogs. The SPModal class is available in Service Portal client scripts.
You can use spModal.open() to display a widget in a modal dialog. The spModal class is a lightweight wrapper for Angular UI bootstrap's $uibModal.
 
Refer this below threads for more
 
 
 
kindly mark Correct and Helpful if applicable.
 
Regards,
Indrajit.

Kanika4
Tera Contributor

Hi siddhnath/Indrajit,

i am looking a way through

<form>
            <sp-model form-model="::data.sc_cat_item" mandatory="c.mandatory"></sp-model>
</form>

Hello Kanika,

try with this code.

<sp-model form-model="::data.sc_cat_item" mandatory="c.mandatory" id="data.sys_id"></sp-model>

and you have to fetch the sys_id like data.sys_id = gr.getUniqueValue(); from server script.

or as in my reply you would see I am passing the sys_id on click of the button.

 

If my answer was able to solve your query please mark it as Helpful & Correct.

Thank you

Siddhnath Pandey