what is the life cycle of widget on Service Portal?

Rushit Patel2
Tera Guru

i have one widget on one page. what is the life cycle of that widget when page loads?

does server script gets executed first? then controller?

if i set data object with something on server script and if i directly use it on HTML template, will it work?

is there any documentaion on spUtil? and snServiceWatcher? whould like to know more about those services/factory.

nathanfirth

1 ACCEPTED SOLUTION

nathanfirth
Tera Guru

Yes, server script loads first and then controller. If all you're doing is loading data from server you can accomplish all of that in the server script by populating "data" and then you don't need a controller at all.



The documentation on most methods is in the editor... meaning as you type it should provide the methods, properties, and descriptions. Do you mean the snRecordWatcher? I'm working on a record watcher tutorial launching this week.... keep checking serviceportal.ioi


View solution in original post

4 REPLIES 4

nathanfirth
Tera Guru

Yes, server script loads first and then controller. If all you're doing is loading data from server you can accomplish all of that in the server script by populating "data" and then you don't need a controller at all.



The documentation on most methods is in the editor... meaning as you type it should provide the methods, properties, and descriptions. Do you mean the snRecordWatcher? I'm working on a record watcher tutorial launching this week.... keep checking serviceportal.ioi


Thank you. i will be wating for turtorials.


Community Alums
Not applicable

This may help,


snRecordWatcher.initList("table","query");



Example:


Client controller:


function($scope,snRecordWatcher)


{


var c=this;


snRecordWatcher.initList("incident","sys_id="+c.data.sys_id);


}




server script:


data.sys_id= $sp.getParameter('sys_id');