segunda-feira, 19 de setembro de 2022

Reabrindo cotações ganhas no Dynamics 365 Sales Professional/Enterprise (C#) 

Primeiro, precisamos alterar o Status e o motivo do status da cotação de volta para Rascunho e em Andamento .

Depois de fazermos modificações na cotação, ela precisa ser definida como Ativa.

E por fim colocar ela com o Status ganha novamente.


1. Colocando uma Quote em Rascunho

Guid quoteID = new Guid("9cc66ad5-2506-4394-854d-f60c35185d96");

Entity quote = new Entity("quote", quoteID);

quote["statecode"] = new OptionSetValue(0); // Draft

quote["statuscode"] = new OptionSetValue(1); // In Progress

service.Update(quote);


ExecuteTransactionRequest transactionRequest = new ExecuteTransactionRequest()

{

    Requests = new OrganizationRequestCollection(),

    ReturnResponses = true,

};

ExecuteTransactionResponse transactionResponse;


Guid quoteID = new Guid("9cc66ad5-2506-4394-854d-f60c35185d96");


2. Ativando uma Cotação em Rascunho

Entity quote = new Entity("quote", quoteID);

quote["statecode"] = new OptionSetValue(1); // Active

quote["statuscode"] = new OptionSetValue(2); // In Progress


UpdateRequest updateRequest = new UpdateRequest()

{

    Target = quote,

};

transactionRequest.Requests.Add(updateRequest);


3. Fechando a cotação para Ganha

Entity quoteClose = new Entity("quoteclose");

quoteClose["subject"] = "Quote Close" + DateTime.Now.ToString();

quoteClose["quoteid"] = quote.ToEntityReference();


WinQuoteRequest winQuoteRequest = new WinQuoteRequest()

{

    QuoteClose = quoteClose,

    Status = new OptionSetValue(-1),

};


transactionRequest.Requests.Add(winQuoteRequest);

transactionResponse = (ExecuteTransactionResponse)service.Execute(transactionRequest);

domingo, 20 de fevereiro de 2022

 

MICROSOFT DYNAMICS 365: NOTIFICAções usando JAVASCRIPT

Notificações de nível de formulário (com e sem persistência), notificações de nível de campo e notificações de caixas popup usando JavaScript.

Sumário

  • Formulário – Set Notification
    formContext.ui.setFormNotification(message, messageType, uniqueId);
  • Formulário – Clear Notification
    formContext.ui.clearFormNotification(uniqueId);
  • Campo Especifico – Set Notification
    formContext.getControl(nomecampo).setNotification(message, uniqueId);
  • Campo Especifico – Clear Notification
    formContext.getControl(nomecampo).clearNotification(uniqueId);
  • Alert Box
    alert(message);
  • Confirmation Box
    confirm(message);
  • Prompt Box
    prompt(message, sampleText);

Notificações no Formulário

Page Level Notification

Abaixo está o código JavaScript que foi utilizado para gerar as notificações mostradas na imagem acima. Portanto, cada vez que um utilizador abrir um formulário de contacto, estas notificações aparecerão sempre na parte superior do formulário.

function FormLevelNotification(executionContext) {
    var formContext = executionContext.getFormContext();    
    formContext.ui.setFormNotification("Example of an ERROR notification. ", "ERROR");
    formContext.ui.setFormNotification("Example of a WARNING notification. ", "WARNING");
    formContext.ui.setFormNotification("Example of an INFORMATION notification.", "INFO");    
}

Notificação especifica de campo

Field Level Notifications

function TvSuscriptionDateValidation(executionContext) {
    var formContext = executionContext.getFormContext();
    var tvSubStartDateLogicalName = "hos_tvsubstartdate";
    var tvSubEndDateLogicalName = "hos_tvsubenddate";
    var startDateField = formContext.getAttribute(tvSubStartDateLogicalName);
    var endDateField = formContext.getAttribute(tvSubEndDateLogicalName);
    var endDateFieldControl = formContext.getControl(tvSubEndDateLogicalName);
    var startDate, endDate;

    if (startDateField != null && endDateField != null) {
        startDate = startDateField.getValue();
        endDate = endDateField.getValue();
        if (IsDate(startDate) && IsDate(endDate) && startDate > endDate ) {
            //Display an error message if the dates entered are logically invalid.
            endDateFieldControl.setNotification("The Subscription End Date cannot be before Subscritpion Start Date.", "tvEndDate");
            endDateField.setValue(null);
        }
        else {
            endDateFieldControl.clearNotification("tvEndDate");            
        }
    }
}

//Verify that the field contains date instead of a null value
function IsDate (input) {
    if (Object.prototype.toString.call(input) === "[object Date]") {
        return true;
    }   
    return false;
}

Popup Notificações

Mensagem de alert

Alert Box

function AlertBox() {
    alert("This is an example of a JavScript Alert window ");

    //Alternatively way of writing an Alert Box with the Window prefix:    
    //window.alert("This is an example of a JavScript Alert window ");
}

Mensagem de Confirmação

Confirmation Box

function ConfirmBox() {    
    var confirmationText;
    if (confirm("Would you like to proceed?")) {
        confirmationText = "You pressed OK!";
    } else {
        confirmationText = "You pressed Cancel!";
    }
    //Using the alert notification to show the option selected
    alert(confirmationText);

    //Alternatively way of writing an Confirm Box with the Window prefix:    
    //window.confirm("Press a button: 'OK' or 'Cancel'");
}

Popup de prompt

Prompt Box

function PromptBox() {
    var userText = prompt("Please enter your name below", "This is sample text ");
    //Using the alert notification to show the text entered in the prompt box
    alert("You said your name is: \n" + userText);   

    //Alternatively way of writing an Prompt Box with the Window prefix:
    //window.prompt("Please enter some text below", "This is sample text ");
}

quinta-feira, 2 de junho de 2016

Nao dispara o WorkFlow CRM

Nao dispara o WorkFlow CRM

Reiniciar os serviços

Serviço de Processamento Assíncrono do Microsoft Dynamics CRM
Serviço de Processamento Assíncrono do Microsoft Dynamics CRM (maintenance)