Wednesday, 4 May 2022

MSCRM hide subgrid '+' button

Hide SubGrid '+' / New Button button based on Parent status

Hide child  records sub grid + or Add New button

Some time we need to hide  '+' button or Add New button for child record grid..





You can do this by adding enable rule for + or Add New Button.

1. Open Child record customization in Ribbon workbench

2.  Select Entity so that we will able to modify command definition.

3. In Sub Gird, select + Add New {0} Button, right click and select Customize Command



4.  Add New Enable Rule


5. For Enable Rule.. Add steps, and select Custom JavaScript Rule

6. Set Custom rule properties as 
Default : true
Function Name: DisableSubGridNewButton
Invert Result : False
Library: JavaScript web resource where you added DisableSubGridNewButton function 
Parameters : None. 



JavaScript DisableSubGridNewButton Function 

-- When Form is ready only then hide +new or Add new Button for child records.
function DisableSubGridNewButton() {
    if (Xrm.Page.ui.getFormType() == 3) // Read Only
        return false;
    else
        return true;
}


-- based on Some values on Form

function DisableSubGridNewButton() {
    var IsMarried = Xrm.Page.getAttribute('new_status').getValue();

    if (IsMarried == 70000001) //un marriged
        return false;  // Hide button
    else
        return true;  //Show button
}


7. Add this enable rule to button Command



8. Save and Publish Customization.

Sunday, 12 July 2020

MSCRM 365 FS and PS Sample data

Download Link:
https://docs.microsoft.com/en-us/dynamics365/field-service/install-sample-data-8-x

Issues:
1. Pre-import checks failed with error: Organizations should have no more than one active 'msdyn_organizationalunit'.

Resolution:
Keep activated just one organizational unit and deactivate temporary other organization units




2. Unable to parse timestamp '5/31/2018 6:13:26 PM' in data. Invalid format.
image

Resolution:
Change the date format to yyyy-mm-dd hh:MM in the data.xml file available in the zip folder (20180517_FPSMasterData).

From:
timestamp="5/31/2018  6:13:26 PM">
To:
timestamp="2018-5-31 6:13:26 PM">


Thanks

Thursday, 19 September 2019

Sharepoint upload file increase and Links

Error:

The request message is too big. The server does not allow messages larger than 2097152 bytes

Solution:

Run script  in Sharepoint Power Shell :
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 20242880
$ws.ClientRequestServiceSettings.MaxParseMessageSize  = 20242880
$ws.Update()

====================
     string documentBody1 = _itemAttachment.Attributes["body"].ToString();
var aaa=new  MemoryStream(Convert.FromBase64String(documentBody1));

   public static void UploadFileToSP(ClientContext ctx, string listName, string fullUrlWithFileName, byte[] content,MemoryStream aaa)
        {
            //  Send the file content to SP
            Microsoft.SharePoint.Client.List list = ctx.Web.Lists.GetByTitle(listName);
            FileCreationInformation file1 = new FileCreationInformation();
            file1.Overwrite = true;
            file1.Url = fullUrlWithFileName;// "/demo/email/57FD46F959DBE81180C200155D668D45_testfilename";// fullUrlWithFileName;
                                            // file1.Content = content;
            file1.ContentStream = aaa;
            Microsoft.SharePoint.Client.File uploadFile = list.RootFolder.Files.Add(file1);
            //list.con
            ctx.Load(uploadFile);
            ctx.ExecuteQuery();
        }
=========================

Sharepoint 'Sync Now' functionality and share files on network drive

https://bitwizards.com/thought-leadership/blog/2015/december-2015/how-to-map-sharepoint-document-libraries-as-networ

https://support.office.com/en-us/article/sync-sharepoint-files-with-the-onedrive-for-business-sync-client-groove-exe-59b1de2b-519e-4d3a-8f45-51647cf291cd


Sharepoint upload solution in SP:
https://sharepoint.stackexchange.com/questions/189704/how-to-upload-a-sharepoint-site-template-wsp-when-the-solution-link-is-missin

https://www.c-sharpcorner.com/UploadFile/93cb27/deploying-the-solution-in-sharepoint-online/

Powershell Script:
Power shell Script

./AllowHtcExtn.ps1 https://mysharepointserver/CRM 




SharePoint Online

FileCreationInformation.Content=Convert.FromBase64String(fileData);
//fileData being the document body of my attachment.

Instead of using the Content method of FileCreationInformation, I used ContentStream as below:

FileCreationInformation.Content=new MemoryStream(Convert.FromBase64String(fileData));



Wednesday, 18 September 2019

MSCRM Disable Fields in Business Process Flow

Add the prefix 'header_process_' of the field schema name 'new_testfield' and use the below script for disabling the field using javascript:

Xrm.Page.getControl('header_process_new_testfield').setDisabled(true);



Thanks
Narendra

Sunday, 15 September 2019

MSCRM 365 v9 bind subgrid using fetch XML by javascript

function QuoteLinesFromQuote(executionContext) { 
    var formContext = executionContext.getFormContext();
    //Show the section on function call.
Xrm.Page.ui.controls.get('Quotelines').setVisible(true);
    // Xrm.Page.ui.tabs.get("tab_Quotes").sections.get("CONTACT_PREFERENCES").setVisible(true);
    // Quotelines : is name of subgrid given on Form. 
    var objSubGrid = window.parent.document.getElementById("Quotelines");
    var globalContext = Xrm.Utility.getGlobalContext();
    var version = globalContext.getVersion();
    // You need the timeout for at least the form is properly loaded.
    var subRowCount = 1;
    if (subRowCount == 0) {
        setTimeout(QuoteLinesFromQuote(executionContext), 5000);
    } else {
        // When subgrid is loaded, get the other relevant value.
        var QuoteIDValue = formContext.data.entity.getId();
        //Create FetchXML for sub grid to filter records
        var FetchXml = '<fetch version = "1.0" output-format="xml-platform" mapping = "logical" distinct = "false" > ' +
            '<entity name="quotedetail">' +
            '<attribute name="productid" />' +
            '<attribute name="productdescription" />' +
            '<attribute name="priceperunit" />' +
            '<attribute name="quantity" />' +
            '<attribute name="extendedamount" />' +
            '<attribute name="quotedetailid" />' +
            '<order attribute="productid" descending="false" />' +
            '<filter type="and">' +
            '<condition attribute="quoteid" operator="eq" uitype="quote" value="{' + QuoteIDValue + '}" />' +
            '</filter>' +
            '</entity>' +
            '</fetch>';

        // Layout of subgrid.
        //var LayoutXml = "<grid name='resultset' object='8' jump='new_name' select='1' preview='1' icon='1'>" +
        //    " <row name='result' id='new_boat'>" +
        //    "<cell name='productid' width='100' />" +
        //    "<cell name='productdescription' width='200' />" +
        //    "<cell name='priceperunit' width='100' />" +
        //    "<cell name='quantity' width='200' />" +
        //    "<cell name='quotedetailid' width='200' />" +
        //    "</row>" +
        //    "</grid>";
        // Apply layout and filtered fetchXML
        //objSubGrid.control.SetParameter("layoutXml", LayoutXml);
        objSubGrid.control.SetParameter("fetchXml", FetchXml);
        //Refresh grid to show filtered records only.
        objSubGrid.control.Refresh();
    }
}

Monday, 19 August 2019

MS CRM Email router Incoming Status : ERR [SYS/TEMP] Temporary system problem. Please try again later.

Error:
Incoming Status: Failure - An error occurred while executing POP3 command "<Command removed for security reasons>". The server response was: "-ERR [SYS/TEMP] Temporary system problem.  Please try again later. l17mb180361752iob".

Solution:
Reset the password of that email ID and update in email router and mailbox profile of CRM then issue will resolve.

Thanks
Narendra Singh

Saturday, 17 August 2019

persits.upload not found

Error:
Microsoft VBScript runtime  error '800a01ad'

ActiveX component can't create object

Set Upload = Server.CreateObject("Persits.Upload")  create object failed

Solution:

Download the aspupload.dll and register the dll by command prompt.

http://www.aspupload.com/download.html


Command Prompt

C:\Program Files (x86)\Persits Software\AspUpload\Bin>regsvr32 aspupload.dll


Thanks