web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Editable Grids & JavaScript

(0) ShareShare
ReportReport
Posted on by

Has anyone had issues with editable grids & JavaScript? I added a JavaScript to the editable grid and now it just freezes and never saves. 

Billing-Checklist-Editable-Grid.png

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Here are the settings I have for the editable grid events. As soon as I change the field Print File # of Pages on the editable grid, it says saving for 10 mins and never actually saves, if I refresh the browser the changes don't save:

    editable-grid-js-settings.png

  • Community Member Profile Picture
    on at

    I realized my code probably doesn't work for an editable grid! Here is my code. Are you able to suggest how to change it to work for an editable grid?

    function PrintName()

    {

    var Vendor = Xrm.Page.getAttribute("new_printvendor").getValue();

    var BRE = Xrm.Page.getAttribute("new_bre").getValue();

    var Invoice = Xrm.Page.getAttribute("new_invoicetemplate").getText();

    var Batch = Xrm.Page.getAttribute("new_printbatch").getValue();

    var Pages = Xrm.Page.getAttribute("new_printfileofpages").getValue();

    var Name = Xrm.Page.getAttribute("new_printfilename").getValue();

    if (Vendor != null && BRE != null && Invoice != null && Batch != null && Pages != null && Name == null) {

    var d = new Date();

    var PrintMonth = (d.getMonth()+1)+"";

    var PrintDay = d.getDate();

    var PrintYear = d.getFullYear();

    if (Vendor == 100000001 && BRE == 100000001) {

    Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + "Invoice" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + "No_BRE" + "_" + "Batch" + Batch);

     }

    if (Vendor == 100000001 && BRE == 100000000) {

    Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + "Invoice" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + "BRE" + "_" + "Batch" + Batch);

     }

    if (Vendor == 100000000 && BRE == 100000001) {

    Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "BillOnly" + "_" + "Template" + Invoice + "_" + "Batch" + Batch + "_" + Pages);

     }

    if (Vendor == 100000000 && BRE == 100000000) {

    Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "Template" + Invoice + "_" + "Batch" + Batch + "_" + Pages);

     }

     }

    }

  • Community Member Profile Picture
    on at

    I tried this and the editable grid will save now but the Print File Name doesn't populate:

    function PrintName(context)

    {

    var Vendor = (context.getFormContext().data.entity).attributes.getByName("new_printvendor");

    var BRE = (context.getFormContext().data.entity).attributes.getByName("new_bre");

    var Invoice = (context.getFormContext().data.entity).attributes.getByName("new_invoicetemplate");

    var Batch = (context.getFormContext().data.entity).attributes.getByName("new_printbatch");

    var Pages = (context.getFormContext().data.entity).attributes.getByName("new_printfileofpages");

    var Name = (context.getFormContext().data.entity).attributes.getByName("new_printfilename");

    if (Vendor != null && BRE != null && Invoice != null && Batch != null && Pages != null && Name == null) {

    var d = new Date();

    var PrintMonth = (d.getMonth()+1)+"";

    var PrintDay = d.getDate();

    var PrintYear = d.getFullYear();

    if (Vendor == 100000001 && BRE == 100000001) {

    Name.setValue( "Multifam" + "_" + "Invoice" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + "No_BRE" + "_" + "Batch" + Batch);

     }

    if (Vendor == 100000001 && BRE == 100000000) {

    Name.setValue( "Multifam" + "_" + "Invoice" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + "BRE" + "_" + "Batch" + Batch);

     }

    if (Vendor == 100000000 && BRE == 100000001) {

    Name.setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "BillOnly" + "_" + "Template" + Invoice + "_" + "Batch" + Batch + "_" + Pages);

     }

    if (Vendor == 100000000 && BRE == 100000000) {

    Name.setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "Template" + Invoice + "_" + "Batch" + Batch + "_" + Pages);

     }

     }

    }

  • Verified answer
    Community Member Profile Picture
    on at

    I was able to get it to work with this:

    function PrintName(context)

    {

    var VendorE = (context.getFormContext().data.entity).attributes.getByName("new_printvendor");

    var BREE = (context.getFormContext().data.entity).attributes.getByName("new_bre");

    var InvoiceE = (context.getFormContext().data.entity).attributes.getByName("new_invoicetemplate");

    var BatchE = (context.getFormContext().data.entity).attributes.getByName("new_printbatch");

    var PagesE = (context.getFormContext().data.entity).attributes.getByName("new_printfileofpages");

    var NameE = (context.getFormContext().data.entity).attributes.getByName("new_printfilename");

    var Vendor = VendorE.getValue();

    var BRE = BREE.getValue();

    var Invoice = InvoiceE.getText();

    var Batch = BatchE.getValue();

    var Pages = PagesE.getValue();

    var Name = NameE.getValue();

    if (Vendor != null && BRE != null && Invoice != null && Batch != null && Pages != null && Name == null) {

    var d = new Date();

    var PrintMonth = (d.getMonth()+1)+"";

    var PrintDay = d.getDate();

    var PrintYear = d.getFullYear();

    if (Vendor == 100000001 && BRE == 100000001) {

    NameE.setValue( "Multifam" + "_" + "Invoice" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + "No_BRE" + "_" + "Batch" + Batch);

     }

    if (Vendor == 100000001 && BRE == 100000000) {

    NameE.setValue( "Multifam" + "_" + "Invoice" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + "BRE" + "_" + "Batch" + Batch);

     }

    if (Vendor == 100000000 && BRE == 100000001) {

    NameE.setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "BillOnly" + "_" + "Template" + Invoice + "_" + "Batch" + Batch + "_" + Pages);

     }

    if (Vendor == 100000000 && BRE == 100000000) {

    NameE.setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "Template" + Invoice + "_" + "Batch" + Batch + "_" + Pages);

     }

     }

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans