Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
Set "to" field on email form i dynamics 365

I am trying to open a new email form in Dynamics 365 using JavaScript. I can easily pre-fill various fields like "Regarding" but when I try to fill the "To" field it just comes out empty.

Here is a small code snippet reproducing my problem:

let contactid = "91be7fec-2142-ec11-8c62-000d3ac23084";
let activityParameters = {};

// Set the regarding field -- this works!
activityParameters["regardingobjectid"] = contactid ;
activityParameters["regardingobjectidname"] = "Regarding your last email";
activityParameters["regardingobjectidtype"] = "contact";

// Set the to field -- this is not working!
var parties = [];
var receiver = {};
receiver["partyid_contact@odata.bind"] = `/contacts(${contactid})`;
receiver["participationtypemask"] = 2; //To
parties.push(receiver);
activityParameters["email_activity_parties"] = parties;
        
await window.parent.Xrm.Navigation.navigateTo(
            { pageType: "entityrecord", entityName: "email", data: activityParameters },
            { target: 2 } // Open in modal
        )

I have also tried some variations based on how lookups are set in other places, like:

var parties = [];
var receiver = {
    activityparty: {
        id: contactid,
        entityType: "contact",
        name: "XXX"
    },
    participationtypemask: 2
};

Googling the problem only gave me solutions for creating emails using the web API (as I have tried above), but I am unsure how to change the code so that navigateTo() recognizes the parameter.

Does anyone have an idea how to go about this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I finally figured it out. Andrew Butenko described how to do it for openForm(), and it turns out the same solution can also be applied to navigateTo().

I'll leave my solution here in case anyone else has the same problem.

let contactid = "91be7fec-2142-ec11-8c62-000d3ac23084";
let activityParameters = {};
​
// Set the to field -- this IS working!
activityParameters["to"] = [{
    id: contactid,
    name: "Contact Name Here",
    entityType: "contact"
}];
      
await window.parent.Xrm.Navigation.navigateTo(
            { pageType: "entityrecord", entityName: "email", data: activityParameters },
            { target: 2 } // Open in modal
        );
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda