AnsweredAssumed Answered

Save onclick : opening new Meetings' EditForm conditionnally

Question asked by Gaelle Fernandez on Jul 25, 2014
Latest reply on Apr 23, 2015 by Emil Maran
Hi there,

(because of the horrible text editor, i'm copying my original thread here : https://community.sugarcrm.com/sugarcrm/topics/save_onclick_opening_new_meetings_editform_conditionn... )

I have a simple question, but it drives me crazy :
(i'm using sugar pro 7.2.0 but the Calls module is under BWC)


On Calls module, i have three fields particular. When they reach together a certain condition, and when user clicks on Save button, i want to save the current call and instead of displaying the Calls detailview, i want to open a new Meeting EditView.

So, when i create a call and save it, if field01 = "condition01" AND field02="condition02" AND field03="condition03", i want to save the current field and then open a new meeting EditForm.

I've customised save button, but well, i'm stuck with what i should call :
(the part interesting us is the {literal} if. with the console.log banana. (now you have the minions in your head)

custom/modules/calls/metadata/editviewdefs.php :

            'customCode' => '<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" id="SAVE_HEADER" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.calls.fill_invitees();document.EditView.action.value=\'Save\'; {literal} if($(\'#status\').val() == \'Held\' && $(\'#type_c\').val() == \'conquete\' && $(\'#status_appel_c\').val() == \'rdv\'){console.log(\'BANANA!!!\');}else{ {/literal}document.EditView.return_action.value=\'DetailView\'{literal}}{/literal}; {if isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true"}document.EditView.return_id.value=\'\'; {/if}formSubmitCheck();;" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">',

How can i do that? by a simple javascript redirection, or i should probably call another form, but i don't know how to say to Sugar "go get the MEETING edit form"

Thanks you a lot.
Gaëlle

Outcomes