domingo, 15 de septiembre de 2013

CRM 4.0 - Agregar el componente plantilla al editor de mail de QuickCampaign

Modificar un componente para añadirle un boton de plantilla


Insercion de este codigo en el EmailForm.aspx del Quick Campaign Form.

(Para quick campaign en emailForm.aspx al final del todo)
<%--Javi--%>
<script type = "text/javascript" language="javascript">
    var sp = "<td unselectable=''on''>";
    sp += " <div unselectable=''on''></div></td>";
    var t = document.getElementById("HTMLBAR");//get the toolbar
    var c = t.getElementsByTagName("TD")[23].outerHTML; //get the first btn
    var v = c.replace("cmd-unsubscribeLink.gif","cmd-insertField.gif"); //clone and change
    v = v.replace("Anular la suscripción ","Insertar Plantilla ");
    v = v.replace(" Anular la suscripción"," Insertar Plantilla");
    v = v.replace("UnsubscribeLink()","ApplyTempCampaign()");
    t.outerHTML = t.outerHTML.replace(c,v+sp+c); //recreate the toolbar
</script>
<%--Javi--%>


Se llama a la función ApplyTempCampaign()


En el onload() de email
ApplyTempCampaign = function (){
//debugger;
    var sUrl = prependOrgName("/_grid/cmds/dlg_bulkemail.aspx?bulkemail=false&objectTypeCode=2&objectId=8AB451FA-4DED-DD11-9AE9-000C29F50BC0");
    var sResponse = openStdDlg(sUrl, null, 600, 350);
    if (sResponse != null)
    {
        crmForm.all.description.InsertValue( sResponse.EmailBody );
        var sEmailSubject = crmForm.all.subject.DataValue;
        if( !IsNull( sEmailSubject ) && sEmailSubject.length > 0 )
        {
            if( !confirm(LOCID_EMAIL_REPLACE_SUBJECT) )
            {
                return;
            }
        }
        crmForm.all.subject.DataValue = CrmEncodeDecode.CrmHtmlDecode(sResponse.EmailSubject).substr(0, crmForm.all.subject.MaxLength);
    }
}
-------------------------------------------

No hay comentarios:

Publicar un comentario