Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Refresh Subgrid to include workflow created records (code posted with error)

$
0
0

first of all here is the reference that I used to base the code off of: http://microxrm.blogspot.com/2013/07/retrieving-subgrid-items-count-using.html

I am posting code.   I am having trouble getting the number of records in the grid and then suppressing the refresh if a certain number of records are there.  I'm using an interval.              

See the comments "//" the 2nd and 3rd lines.  I'm pretty sure that is where it fails.


I'm open to doing this in a different way.  The key is that we are creating associated records 'onload' through workflow and need the  grid to reload once the records are there.

function refresh_init() {    
                setInterval(function () { refact() }, 1000);
                setInterval(function () { refcnt() }, 1000);
                    }
                
            

            function refact()
            {
                var LinkedAccounts = Xrm.Page.ui.controls.get("LinkedAccounts");
                if (LinkedAccounts != null) {
                    var countAct = LinkedAccounts.get_innerControl().get_allRecordIds().length; // causes error
                if (countAct < 16) {
                    LinkedAccounts.refresh();

                   }
                }
            }

            function refcnt()
            {
                var LinkedContacts = Xrm.Page.ui.controls.get("LinkedContacts");
                if (LinkedContacts != null) {
                    var countCnt = LinkedContacts.get_innerControl().get_allRecordIds().length;   // causes error
                if (countCnt < 16) {
                    LinkedContacts.refresh();
                    }
                }
            }


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images