<div dir="ltr">Istvan,<div><br></div><div>Register HEADERSCRIPT of your custom module that should get loaded on all pages. </div><div>Make sure to react based on the target module you are interested in (app.getModuleName())</div>

<div><br></div><div>Regards,</div><div>Prasad</div></div><div class="gmail_extra"><br clear="all"><div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><b>Connect with us on: </b><a href="http://twitter.com/vtigercrm" style="color:rgb(0,0,204)" target="_blank">Twitter</a> <b>I</b> <a href="http://www.facebook.com/pages/vtiger/226866697333578?sk=wall" style="color:rgb(0,0,204)" target="_blank">Facebook</a> <b>I</b> <a href="https://blogs.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Blog</a><b> I</b> <a href="http://wiki.vtiger.com/index.php/Main_Page" style="color:rgb(0,0,204)" target="_blank">Wiki</a> <b>I </b><a href="https://discussions.vtiger.com" style="color:rgb(0,0,204)" target="_blank">Forums </a><b>I</b> <a href="https://www.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Website</a></span></div>


<br><br><div class="gmail_quote">On Tue, Jul 15, 2014 at 9:19 PM, Holbok István <span dir="ltr"><<a href="mailto:holbok@gmail.com" target="_blank">holbok@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Prasad,<br>
      Thank you very much for the suggestion.<br>
      <br>
      It is clear for my custom module, and I understood it and tested,
      it works well.<br>
      <br>
      My Current page is <b>Contacts </b>and the last performed action
      was Save Contacts record (after updating or creating a new)<br>
      ( index.php?module=Contacts&view=Detail&record=$RecordID )<br>
      and I would like to notify the vtiger user about a necessary
      action with a related Custom module of this Contacts record,<br>
      and I would like to get a feedback from the user and if the choice
      is YES, <br>
      I would like to redirect the User to the page create a new Custom
      module record. I think using the quick create record link it is
      possible with autofill of necessary fields.<br>
      <br>
      Is it possible to inject necessary Javascript code to the Contacts
      module pages without modifying the core files of Contacts module
      to perform all this above?<br>
      <br>
      <div>Kindest regards:<br>
        Istvan<br>
        <br>
      </div>
      2014.07.15. 14:36 keltezéssel, Prasad írta:<br>
    </div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">Istvan,</span><br>
        <div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">If
            you expect user-feedback post-request I would suggest the
            following:</span></div>
        <div>
          <ul>
            <li><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">On
                the Current page - show progress bar / message.</span><br>
            </li>
            <li><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">Perform
                an call to Action Controller through Ajax (look at
                resources/app.js - AppConnector.request)- parse the
                response.</span><br>
            </li>
            <ul>
              <li><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">On
                  success - redirect to target page.</span></li>
              <li><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">On
                  error - show feedback to user.</span></li>
            </ul>
          </ul>
        </div>
        <div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">Regards,</span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">Prasad</span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br>
          </span></div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><b>Connect
              with us on: </b><a href="http://twitter.com/vtigercrm" style="color:rgb(0,0,204)" target="_blank">Twitter</a> <b>I</b> <a href="http://www.facebook.com/pages/vtiger/226866697333578?sk=wall" style="color:rgb(0,0,204)" target="_blank">Facebook</a> <b>I</b> <a href="https://blogs.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Blog</a><b> I</b> <a href="http://wiki.vtiger.com/index.php/Main_Page" style="color:rgb(0,0,204)" target="_blank">Wiki</a> <b>I </b><a href="https://discussions.vtiger.com" style="color:rgb(0,0,204)" target="_blank">Forums </a><b>I</b> <a href="https://www.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Website</a></span></div>


        <br>
        <br>
        <div class="gmail_quote">On Tue, Jul 15, 2014 at 5:32 PM, Holbok
          István <span dir="ltr"><<a href="mailto:holbok@gmail.com" target="_blank">holbok@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <div>Dear Prasad,<br>
                <br>
                Thank you for the suggestion.<br>
                <br>
                If I understand well, I can use the event handler to do
                some things triggered by the vtiger.entity.aftersave
                event.<br>
                To continue the flow is the best to redirect to the
                action controller,  with <br>
                    $redirectUrl = 'index.php?module=Custommodule&<b>action</b>=Customaction&mode=Custommode';
                <div><br>
                      header("Location: $redirectUrl");<br>
                      exit();<br>
                  <br>
                </div>
                And in the process function of the Customaction
                Controller is suggested to make the control flow
                decision.<br>
                <br>
                And if I would like to insert a modal popup window to
                notify the vtiger user and ask him to decide something,
                then I can insert into the page HTML using
                Vtiger_Response::Emit() the HTML content of this modal
                popup window from the Customaction Controller.<br>
                <br>
                It was your suggestion?<br>
                <br>
                <br>
                <div>Kindest regards:<br>
                  Istvan<br>
                  <br>
                </div>
                2014.07.15. 7:49 keltezéssel, Prasad írta:<br>
              </div>
              <div>
                <div>
                  <blockquote type="cite">
                    <div dir="ltr">NOTE:
                      <div><br>
                        <div>Its either View or Action Controller which
                          should make the control flow decision.</div>
                        <div><br>
                        </div>
                        <div>Delegating it to (mode / record - like
                          event handler) would create trouble when its
                          gets executed through Webservices.</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                    </div>
                    <div class="gmail_extra"><br clear="all">
                      <div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><b>Connect

                            with us on: </b><a href="http://twitter.com/vtigercrm" style="color:rgb(0,0,204)" target="_blank">Twitter</a> <b>I</b> <a href="http://www.facebook.com/pages/vtiger/226866697333578?sk=wall" style="color:rgb(0,0,204)" target="_blank">Facebook</a> <b>I</b> <a href="https://blogs.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Blog</a><b> I</b> <a href="http://wiki.vtiger.com/index.php/Main_Page" style="color:rgb(0,0,204)" target="_blank">Wiki</a> <b>I </b><a href="https://discussions.vtiger.com" style="color:rgb(0,0,204)" target="_blank">Forums </a><b>I</b> <a href="https://www.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Website</a></span></div>


                      <br>
                      <br>
                      <div class="gmail_quote">On Tue, Jul 15, 2014 at
                        11:17 AM, Prasad <span dir="ltr"><<a href="mailto:prasad@vtiger.com" target="_blank">prasad@vtiger.com</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div dir="ltr">
                            <div>Reference:</div>
                            <a href="http://community.vtiger.com/help/vtigercrm/developers/extensions/internals.html#ui-request-processing" target="_blank">http://community.vtiger.com/help/vtigercrm/developers/extensions/internals.html#ui-request-processing</a>
                            <div> <br>
                            </div>
                            <div>The View request flow would go through
                              <div><br>
                              </div>
                              <div>preProcess</div>
                              <div>process</div>
                              <div>postProcess</div>
                              <div><br>
                              </div>
                              <div>Redirection in process would fail as
                                preProcess emits some content - you many
                                have to override this.</div>
                              <div>Action is best candidate since
                                preProcess and postProcess is not
                                triggered.</div>
                              <div><br>
                              </div>
                              <div>Regards,</div>
                              <div>Prasad</div>
                              <div><br>
                              </div>
                            </div>
                          </div>
                          <div class="gmail_extra"><br clear="all">
                            <div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><b>Connect

                                  with us on: </b><a href="http://twitter.com/vtigercrm" style="color:rgb(0,0,204)" target="_blank">Twitter</a> <b>I</b> <a href="http://www.facebook.com/pages/vtiger/226866697333578?sk=wall" style="color:rgb(0,0,204)" target="_blank">Facebook</a> <b>I</b> <a href="https://blogs.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Blog</a><b> I</b> <a href="http://wiki.vtiger.com/index.php/Main_Page" style="color:rgb(0,0,204)" target="_blank">Wiki</a> <b>I </b><a href="https://discussions.vtiger.com" style="color:rgb(0,0,204)" target="_blank">Forums </a><b>I</b> <a href="https://www.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Website</a></span></div>


                            <br>
                            <br>
                            <div class="gmail_quote">
                              <div>
                                <div>On Tue, Jul 15, 2014 at 12:37 AM,
                                  Holbok István <span dir="ltr"><<a href="mailto:holbok@gmail.com" target="_blank">holbok@gmail.com</a>></span>
                                  wrote:<br>
                                </div>
                              </div>
                              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                <div>
                                  <div>
                                    <div text="#000000" bgcolor="#FFFFFF">
                                      <div> Dear Vtiger Community,<br>
                                        <br>
                                        I would like to redirect a view
                                        in vtiger 6.1. What is the best
                                        suggested way to do it?<br>
                                        <br>
                                        Case:<br>
                                        There is an event handler
                                        registered to the Contacts
                                        (standard) module in my Custom
                                        module.<br>
                                        The Save action in the Contacts
                                        module triggered the event
                                        handler and I could see, the
                                        program executed. The red line
                                        log the info to the logfile.<br>
                                        <br>
                                                if($eventName ==
                                        'vtiger.entity.aftersave') {<br>
                                                    // Entity has been
                                        saved, take next action<br>
                                                    <b><font color="#cc0000">$log->debug('Contacts:


                                            vtiger.entity.aftersave ---
                                            fired in Custommodule
                                            directory');</font></b><br>
                                                    <br>
                                                   // Check some
                                        conditions<br>
                                                <br>
                                                     // If the
                                        conditions true, redirect the
                                        view<br>
                                                    $redirectUrl =
                                        'index.php?module=<b><font color="#cc0000">Custommodule</font></b>&view=<b><font color="#cc0000">Customview</font></b>';<br>
                                                    header("Location:
                                        $redirectUrl");<br>
                                      </div>
                                                 <b><font color="#000099"> exit();</font></b><br>
                                                  <br>
                                              }<br>
                                      <br>
                                      Adding the command <b><font color="#000099">exit();</font></b>
                                      after the line of header the
                                      redirection started work.<br>
                                      <br>
                                      But the question is still exist: <b>Is
                                        this way the best method to
                                        change vtiger view depending a
                                        condition?</b><br>
                                      <br>
                                      <br>
                                      Other question is: How to do
                                      different modal popup windows
                                      related to the
                                      'vtiger.entity.aftersave' event of
                                      the Contacts module without
                                      rewriting the original code?
                                      <div><br>
                                        <br>
                                        Any suggestion is appreciated.<br>
                                        <br>
                                        Kindest regards:<br>
                                        Istvan<br>
                                        <br>
                                        <br>
                                        <div>-- <br>
                                          üdvözlettel:<br>
                                          <br>
                                          <b>Holbok István</b><br>
                                          <br>
                                          +3670-342-0900<br>
                                          <b>e-mail:</b> <a href="mailto:holbok@gmail.com" target="_blank">holbok@gmail.com</a><br>
                                          <b>SkyPe:</b> holboki<br>
                                          <br>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
                                  </div>
                                </div>
_______________________________________________<br>
                                <a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
                              </blockquote>
                            </div>
                            <br>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <br>
  </div></div></div>

</blockquote></div><br></div>