Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda