tips & tricks


Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Bottone Custom per Creare un'appointment da una Campaign.


Di default, non si capisce perchè?.., ma nella grid della "campaign" quando visualizzo le attività di tipo "appointment" non mi dà la possibilità di crearne delle nuove perchè non c'è nessun bottone ... al contrario delle altre attività. La procedura per aggiungere questo bottone non è difficile ma prende un pò di tempo:

1) Bisogna scaricare l' ISV config e aggiungere il bottone non alla campaign, come si potrebbe pensare, ma all'entità appointment per poterlo visualizzare nella GRID della campaign:

<Entity name="appointment">
              <Grid><MenuBar>
                      <Buttons>
                          <Button Icon="/_imgs/ico_18_debug.gif" Url="/activities/appointment/edit.aspx" WinParams="" WinMode="3">
                              <Titles>
                                  <Title LCID="1033" Text="Add New RoadShow Meeting" />
                              </Titles>
                              <ToolTips>
                                  <ToolTip LCID="1033" Text="Add New RoadShow Meeting" />
                              </ToolTips>
                          </Button>
                      </Buttons>
                  </MenuBar>
              </Grid>
</Entity>

2) Chiaramente bisogna dire al bottone che sull'onclick mi deve aprire un nuovo appointment, e per fare queto basta passargli il link alla pagina del crm "appointment/edit.aspx" per la creazione di nuovi appointment.

3) Se voglio fare qualche automatizzazione sulla creazione del nuovo appointment dalla campaign, passandogli qualche valore della campaign non posso agire come al solito con la querystring, e quindi non posso passare i parametri direttamente dalla campaign all'appointment. La soluzione migliore è cercare di recuperare le informazioni direttamente dall'appointment grazie all'oggetto windows.opener che mi dà le informazioni relative a chi ha aperto l'appointment. Infatti nel nostro caso l'opener è un'entità e quindi ha le proprietà che ci servono, ma bisogna sempre fare un controllo perchè l'attività potrebbe essere aperta da tante altre parti, e magari queste proprietà non sono più valide, scatenando in questo modo un  errore.

IsDirty

ObjectId --> String A read-only property that contains the ID of the entity instance displayed in the form. If the form is a create form, the value is null.

ObjectTypeCode --> String A read-only property that contains the entity type code of the entity instance displayed in the form.                               

ObjectTypeName --> String A read-only property that contains the entity name of the entity instance displayed in the form.

all.{field name}  --> Per recuperare i campi della form.

I controlli importanti da fare sono:

 function fillCampaign()
{
    var CRM_FORM_TYPE_CREATE = "1";


    if (crmForm.FormType==CRM_FORM_TYPE_CREATE)   <---- Anzitutto controllo se sono in creazione
    {
        if(window.opener)   <------ Poi controllo che esista l'oggetto opener
        {
            try       <------- E infine metto un bel try catch di modo che se la pagina chimante non è un entità e scatena un errore, lo catturo.
chimante non è un entità 

            {
                var opener = window.opener.top;
         
                var Id = opener.crmForm.ObjectId;
                var Name = opener.crmForm.all.name.DataValue;
                var TypeCode = opener.crmForm.ObjectTypeCode;
               
                if(TypeCode == "4400")
                {       
                    var lookupData = new Array();
                    var lookupItem= new Object();

                    //Set the id, typename, and name properties to the object.
                    lookupItem.id = Id;
                    lookupItem.type = TypeCode;
                    //lookupItem.typename = "campaign"; 4400
                    lookupItem.name = Name;

                    // Add the object to the array.
                    lookupData[0] = lookupItem;

                    // Set the value of the lookup field to the value of the array   
                    crmForm.mb_campaignid.DataValue = lookupData;
                }
            }
            catch (e)
            {
                //la pagina chimante non è un entità
            }
        }
    }
}

 

 

Categoria: CRM 4.0
giovedì, 10 lug 2008 Ore. 15.24
Archivio Posts
Anno 2020

Anno 2018

Anno 2015

Anno 2013

Anno 2011

Anno 2010

Anno 2009

Anno 2008
Statistiche
  • Views Home Page: 13.379
  • Views Posts: 56.183
  • Views Gallerie: 2.837
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003