الخميس، 1 ديسمبر 2016

SSRS: ASP.Net ReportViewer control doesn't appear in Chrome or Safari

To solve this issue you have two solution as below:
1- Just include SizeToReportContent="true" as shown below
<rsweb:ReportViewer ID="ReportViewer1" runat="server" SizeToReportContent="True"...

2- Use the following JQuery code in the ASPX page:
<script type="text/javascript"> $(function () { // Bug-fix on Chrome and Safari etc (webkit) if ($.browser.webkit) { // Start timer to make sure overflow is set to visible setInterval(function () { var div = $('#<%=ReportViewer1.ClientID %>_fixedTable > tbody > tr:last > td:last > div') div.css('overflow', 'visible'); }, 1000); } }); </script>

الاثنين، 14 نوفمبر 2016

CRM 2011/2013/2015/2016: The date-time format is invalid, or value is outside the supported range

when I try to “invoice” the contract by click "Ready to invoice button on contract form i get the following error message:

"The date-time format is invalid, or value is outside the supported range"

To solve this error Make sure that the billing start and end dates are set.

السبت، 15 أكتوبر 2016

AX 2012: cil generation the given key was not present in the dictionary

When i try to generate incremental CIL i face this error
"cil generation the given key was not present in the dictionary"


To fix this error you should check the CIL log file, it is located at "C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL\Dynamics.Ax.Application.dll.log"

Here you will find the AOT object for which the CIL generator found the error. Compile that object, fix the error and then regenerate the IL. 

Before generating IL it is good practise to make sure that there are no compilation errors in the code.

الأحد، 12 يونيو 2016

How to get entity Image and display in ASP.Net Gridview in CRM 2013/2015

//Get the Image of Product for CRM Online.

public static DataTable GetProductWithImages()
        {
            try
            {

                OrganizationService _service = new OrganizationService(CRMConnection);
                
                DataTable dTable = new DataTable();

                dTable.Columns.Add("Name");
                dTable.Columns.Add("Id");
                dTable.Columns.Add("Image",typeof(byte[]));

                string Fetch = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                                  <entity name='product'>
                                    <attribute name='name' />
                                    <attribute name='producttypecode' />
                                    <attribute name='productnumber' />
                                    <attribute name='entityimage' />                                    
                                    <attribute name='productid' />
                                    <order attribute='name' descending='false' />
                                    <filter type='and'>
                                      <filter type='or'>
                                        <condition attribute='statecode' operator='eq' value='0' />
                                        <condition attribute='statecode' operator='in'>
                                          <value>3</value>
                                          <value>0</value>
                                        </condition>
                                      </filter>
                                    </filter>
                                  </entity>
                                </fetch>";

               
                EntityCollection Product = Common._service.RetrieveMultiple(new FetchExpression(Fetch));
                if (Product != null && Product.Entities.Count > 0)
                {
                    foreach (Entity ent in Product.Entities)
                    {
                        DataRow dRow = dTable.NewRow();
                        if (ent.Attributes.Contains("name"))
                            dRow["Name"] = ent.Attributes["name"].ToString();
                        if (ent.Attributes.Contains("productid"))
                        {
                            string ProductId = ent.Attributes["productid"].ToString();
                            dRow["Id"] = ProductId;
                        }

                        if (en.Attributes.Contains("entityimage"))
                        {
                            dRow["Image"] = en.Attributes["entityimage"] as byte[];
                        }
                        else
                            dRow["Image"] = null;

                        dTable.Rows.Add(dRow);
                    }
                }

                return dTable;
            }
            catch (Exception ex)
            {
                return null;
            }
        }

//**** now to display in asp gridview do the follwing:

// **** In ASPX*****
<asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" Width="90%">
    <Columns>
        <asp:TemplateField HeaderText="Quantity">
            <ItemTemplate>
                <img src='<%# Eval("Image") != System.DBNull.Value ? string.Format("data:image/jpg;base64,{0}",Convert.ToBase64String((byte[])Eval("Image"))) : "Images/No_image.jpg" %>' alt="image" height="144" width="144" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>


//**** In code behind *****

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FillGrid();
        }
    }
    public void FillGrid()
    {
        grvProduct.DataSource = GetProductWithImages();
        grvProduct.DataBind();
    }

الثلاثاء، 9 فبراير 2016

CRM 2013:Check record duplicate detection Using C# .

 Entity Account= new Entity("account");
            Account["name"] = "Test Account";
            Account["accountnumber"] = "111111111";

Microsoft.Crm.Sdk.Messages.RetrieveDuplicatesRequest req = new Microsoft.Crm.Sdk.Messages.RetrieveDuplicatesRequest
                {
                    BusinessEntity = Account,
                    MatchingEntityName = "account",
                    PagingInfo = new PagingInfo() { PageNumber = 1, Count = 50 }
                };

                Microsoft.Crm.Sdk.Messages.RetrieveDuplicatesResponse resp = (Microsoft.Crm.Sdk.Messages.RetrieveDuplicatesResponse)Service.Execute(req);

                if (resp.DuplicateCollection.Entities.Count > 0)
                    continue;

الأربعاء، 20 يناير 2016

AX 2012: Using X++ Get the NumberSeq and Voucher for LedgerJournalTrans Table


LedgerJournalNameId     journalName = "VENPM";
NumberSeq numberseq;

numberseq  =  NumberSeq::newGetVoucherFromId((LedgerJournalName::find(journalName ).NumberSequenceTable));

ledgerJournalTrans.Voucher = numberseq.voucher();

الثلاثاء، 19 يناير 2016

CRM 2013 Error: Maximum record limit is exceeded. Reduce the number of records

When you open a chart in CRM 2013 and get this error "Maximum record limit is exceeded. Reduce the number of records", it's because the number of records to fetch is more than 50.000.

To solve do the following:

--****** get the number of records to be fetched ***********
Use MSCRM_CONFIG
Select IntColumn from [MSCRM_CONFIG].[dbo].[DeploymentProperties] 
where ColumnName = 'AggregateQueryRecordLimit'

--*********************** increasing the number of records to be fetched ***
Use MSCRM_CONFIG 
UPDATE [MSCRM_CONFIG].[dbo].[DeploymentProperties] 
SET [IntColumn] = '99999999' 
WHERE ColumnName = 'AggregateQueryRecordLimit'

الخميس، 7 يناير 2016

CRM 2011: Hiding Ribbon Button on Click/Select SubGrid using JavaScript.

function OnSubGridClicked() {
    var GridCtrl = document.getElementById("gridname");
    if (GridCtrl == null || GridCtrl.readyState != "complete") {
        setTimeout('OnSubGridClicked()', 1000);
        return;
    }
    else {
        GridCtrl.onload = HideRibbon;
        GridCtrl.onclick = HideRibbon;
        GridCtrl.onfocus = HideRibbon;
    }
}

function HideRibbon() {
    if (window.top.document.getElementById("RibbonId") != null) {
        window.top.document.getElementById("RibbonId").style.display = "none";
        setTimeout(" HideRibbon('"RibbonId"');", 200);
    }
}

الأربعاء، 6 يناير 2016

CRM 2011: Updating record the plugin was fired by / from does not work.


1- Register in Async-post-update with the check of

if (context.Depth > 1){ return; }  //To Avoid Multiple Trigger Of Same Update Plugin.

2- Register in Sync-post-update:
Try Creating a new Object for Updating the record Like

  Entity test=new Entity("contact");
  test.Id=((Entity)context.InputParameter["Target"]).Id;
  test.Attributes["firstname"]="ABC";
  service.Update(test);