Dynamics 365





Sunday, November 17, 2019

Dynamics 365 make invoice active and Paid using C#.net code or plugin




Dynamics 365 make invoice active and Paid using C#.net code or plugin


                foreach (var item in ERPInvoices.Entities)
                {
// Set active
                    SetStateRequest setStateRequest = new SetStateRequest()
                    {
                        EntityMoniker = new EntityReference
                        {
                            Id = new Guid(item["invoiceid"].ToString()),
                            LogicalName = "invoice",
                        },
                        State = new OptionSetValue(0),

                        Status = new OptionSetValue(1)

                    };
                    _CrmService.Execute(setStateRequest);

                  // Update the field

                    Entity invoiceToUpdate = new Entity("invoice");
                    invoiceToUpdate.Id = item.Id;
                    if (issendfullyerp)
                    {
                        invoiceToUpdate.Attributes["has_issendfullyerp"] = true;
                    }
                    if (issendpartiallyerp)
                    {
                        invoiceToUpdate.Attributes["has_issendpartiallyerp"] = true;
                    }
                    _CrmService.Update(invoiceToUpdate);
//set abck paid - to old status
                    SetStateRequest request = new SetStateRequest()
                    {
                        EntityMoniker = new EntityReference
                        {
                            Id = new Guid(item["invoiceid"].ToString()),
                            LogicalName = "invoice",
                        },
                        State = new OptionSetValue(2),
                        Status = new OptionSetValue(100001),
                    };

                    _CrmService.Execute(request);

}

Tuesday, October 1, 2019

Field Service WoodFord Resco Mobile App On save validation - Make mandatory

Field Service WoodFord Resco Mobile App On save validation - Make mandatory

Dnamics 365 field services WoordFord design - Make a field mandatory on save event.

make ATE Number mandatory on save event eventhough user not changed any data.

Normally if you open existing record on mobile app where one field should be madatory before proceed with save where same field is not mandatory or business required on CRM.

in this case we can follow below steps to make any field mandatory on save..

OnLoad Event
Open On Load event of form and keep condition you required - then update any field (modified on) so on save event will make sure field mandatory.



OnSave Event

to check the condition we should use Entity.FieldName  

Use error message insted of form.field name.error message