Multiple OnClicks within a UI Action is it possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2014 04:39 AM
I have a UI Action called "Submit for Review" on a form that I want to execute 2 events when I clcik on it.
Event 1)Move the record onto a different phase
2)Send an Email to numerous people advising of the change of phase.
I use the following OnClick event to move the record to the next phase.
OnClick = moveToReview()
function moveToReview(){
removeMandatoryFieldsReview();
gsftSubmit(null, g_form.getFormElement(), 'move_to_review'); //MUST call the 'Action name' set in this UI Action
}
if(typeof window == 'undefined'){
moveToReviewServer();
}
function moveToReviewServer(){
action.setRedirectURL(current);
current.state = '13';
current.u_release_phase = 'In Progress';
current.update();
But can I add another one into this script to send out emails ie
Onclick = sendreviewemail
function sendreviewemail(){
var release_number = g_form.getValue("number");
//Initialize and open the Dialog Window
var dialog = new GlideDialogWindow("email_preview_rel_in_prog");
dialog.setSize(1200,1200);
dialog.setTitle("Release Review Request Notification Preview");
dialog.setPreference("release_number", release_number);
dialog.render();
action.setRedirectURL(current);
Appreciate any help with this.
Cheers Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2014 04:45 AM
hi Adam,
I was wondering why do you need a client UI action to do this job. You can still do this with a server side UI action, to change the status of the record and also the send an email via eventQueue and configuring an event and email notification. Will this not satisfy the usecase
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2014 05:54 AM
Hi Chandana
I was just using what was in place already and trying to adapt. Is it best to move both events into a single Server side UI action or keep the events seperate.
Apologies for the dumb questions Im new to this development piece so am trtying to find my feet.
Cheers Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2014 05:57 AM
HI Adam,
Server side is definitely faster and more efficient than client side. For your usecase if you dont have to show any user messages or wait for any user action, you can use server side UI action to do both the jobs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2014 06:04 AM
The popping up of the GlideDialogWindow will need to happen in the client before the server side function gets called and run, because when that runs the record is going to refresh.
As the others say though if you don't need pop ups or any client side interaction, move it to server side, client stuff should only be if you need to alert the user to fill more stuff in, or ask them more questions or pop something up etc.
cheers,
Marc